国产精品1024永久观看,大尺度欧美暖暖视频在线观看,亚洲宅男精品一区在线观看,欧美日韩一区二区三区视频,2021中文字幕在线观看

  • <option id="fbvk0"></option>
    1. <rt id="fbvk0"><tr id="fbvk0"></tr></rt>
      <center id="fbvk0"><optgroup id="fbvk0"></optgroup></center>
      <center id="fbvk0"></center>

      <li id="fbvk0"><abbr id="fbvk0"><dl id="fbvk0"></dl></abbr></li>

      交互式玩具的制作方法

      文檔序號:3430938閱讀:830來源:國知局

      專利名稱::交互式玩具的制作方法
      技術(shù)領(lǐng)域
      :本發(fā)明總地涉及計算機系統(tǒng)和方法,且更具體地涉及交互式構(gòu)造的開發(fā),講授這樣的開發(fā)的技術(shù)和言語交互式玩具。
      背景技術(shù)
      :在現(xiàn)有技術(shù)中已知有各種言語交互式玩具。總地說來,這些玩具可被劃分成兩類,計算機游戲和獨立玩具。這些獨立玩具典型地在內(nèi)部裝有電子電路,通常提供相對低水平的語音識別和非常有限的詞匯,經(jīng)常導致在玩耍期間兒童產(chǎn)生厭煩和進行破壞。計算機游戲可得到基本的計算能力的受益且因此可提供高水平的語音識別且使用戶滿意。它們的特征在于非言語方面是虛假的且因此缺乏與孩子門結(jié)合的能力。以下的專利相信代表了言語交互式玩具的技術(shù)狀況授予郝格魯(Haugerud)的美國專利No.4,712,184描述了一種計算機控制的教育玩具,其結(jié)構(gòu)可起到教導用戶關(guān)于計算機的術(shù)語和編程及機器人技術(shù)的作用。郝格魯說明了通過有線連接的計算機玩具控制,典型地,其中的計算機用戶需編寫一個簡單的程序來控制機器人的運動。授予羅斯(Rose)的美國專利No.4,840,602描述了一種會響應(yīng)于外部信號而說話的玩偶,其中該玩偶有一個以數(shù)字數(shù)據(jù)形式存儲在一個存儲器中的詞匯庫,當該存儲器被訪問時將會使玩偶內(nèi)的一個語音合成器模仿說話。授予蘭格(Lang)的美國專利No.5,021,878描述了一種可實時控制的動畫角色系統(tǒng)。授予蘭格的美國專利No.5,142,803描述了一種可實時控制的動畫角色系統(tǒng)。授予阿達伐(Aldava)等人的美國專利No.5,191,615描述了一種互聯(lián)聲動娛樂系統(tǒng),其中向電視屏幕外面的一些會動和會聽的玩具和其他可動裝置提供與一個電視節(jié)目相同步的聲音和控制數(shù)據(jù),使之根據(jù)電視節(jié)目的進程與節(jié)目觀看者互相作用。授予庫利埃(Collier)的美國專利No.5,195,920描述了一種無線電控制的玩具車輛,它能產(chǎn)生逼真的聲響效果。與一個遠地計算機相通信可使得操作人能修改和增添新的聲響效果。授予??ㄍ?Hikawa)的美國專利No.5,270,480描述了一種能響應(yīng)于一個MIDI(樂器數(shù)字界面)信號而動作的玩具,其中一個玩著樂器的玩具會表演模擬的樂器彈奏動作。授予蘭格的美國專利No.5,289,273描述了一種用來遙控一個動畫角色的系統(tǒng)。該系統(tǒng)利用無線電信號把聲頻、視頻和其他控制信號傳送給動畫角色,實時地使之說話、聆聽、觀看和運動。美國專利No.5,388,493描述了一種手風琴師用的容納一個垂直雙鍵盤MIDI無線控制器的系統(tǒng)。該系統(tǒng)既可按普通MIDI電纜連接使用,也可被無線MIDI發(fā)送系統(tǒng)使用。授予諾依希爾(Neuhierl)的德國專利DE3009-040描述了一種用來增添從遙控器向受控模型車輛發(fā)送聲音的能力的裝置。其中的聲音由話筒或磁帶錄音機產(chǎn)生,并通過無線電通信發(fā)送給受控模型車輛。模型車輛上裝備了一個能把接收到的聲頻信號放出來的揚聲器。本說明書中所有提到和引用的出版物的公開內(nèi)容均在此引用作為參考。發(fā)明的技術(shù)方案本發(fā)明目的在于提供克服上述現(xiàn)有技術(shù)缺陷的言語交互式玩具及其方法。根據(jù)本發(fā)明的一優(yōu)選實施例提供了一交互式玩具設(shè)備,包括具有有趣的物理外觀的一玩具;安裝在該玩具上的一揚聲器;一用戶輸入接收器;存儲有關(guān)至少一用戶的信息的一用戶信息存儲單元;和一內(nèi)容控制器,其響應(yīng)于經(jīng)該用戶輸入接收器接收的當前用戶輸入和該存儲單元中存儲的信息進行工作,經(jīng)該揚聲器提供音頻內(nèi)容給該用戶。再根據(jù)本發(fā)明的一優(yōu)選實施例,該用戶輸入接收器包括一音頻接收器。再根據(jù)本發(fā)明的一優(yōu)選實施例,該當前用戶輸入包括經(jīng)該音頻接收器接收的一言語輸入。再根據(jù)本發(fā)明的一優(yōu)選實施例,該用戶輸入接收器包括一觸覺輸入接收器。再根據(jù)本發(fā)明的一優(yōu)選實施例,該存儲單元存儲有關(guān)至少一用戶的個人信息且該內(nèi)容控制器進行工作以使該音頻內(nèi)容人性化。再根據(jù)本發(fā)明的一優(yōu)選實施例,該存儲單元存儲有關(guān)至少一用戶與該交互式玩具設(shè)備的交互的信息且該內(nèi)容控制器進行工作以根據(jù)存儲的有關(guān)該至少一用戶與該交互式玩具設(shè)備的過去的交互的信息來控制該音頻內(nèi)容。再根據(jù)本發(fā)明的一優(yōu)選實施例,該存儲單元還存儲有關(guān)至少一用戶與該交互式玩具設(shè)備的交互的信息且該內(nèi)容控制器還進行工作以根據(jù)有關(guān)該至少一用戶與該交互式玩具設(shè)備的過去的交互的信息來控制該音頻內(nèi)容。再根據(jù)本發(fā)明的一優(yōu)選實施例,該存儲單元還存儲由一用戶經(jīng)該用戶輸入接收器言語地輸入的信息。而且,再根據(jù)本發(fā)明的一優(yōu)選實施例,該存儲單元還存儲由一用戶經(jīng)該用戶輸入接收器言語地輸入的信息。而且,再根據(jù)本發(fā)明的一優(yōu)選實施例,該存儲單元還存儲由一用戶經(jīng)該用戶輸入接收器言語地輸入的信息。再根據(jù)本發(fā)明的一優(yōu)選實施例,該交互式玩具設(shè)備還包括一內(nèi)容存儲單元,存儲經(jīng)該揚聲器待被播送給一用戶的至少一內(nèi)容標題的的音頻內(nèi)容,該至少一內(nèi)容標題是交互式的且包含交互分支。而且,再根據(jù)本發(fā)明的一優(yōu)選實施例,該至少一內(nèi)容標題包括存儲對應(yīng)的多個內(nèi)容標題部分的多個音頻文件,該多個內(nèi)容標題部分包括至少兩個可替換的內(nèi)容標題部分;和響應(yīng)于一任意的一用戶輸入、一環(huán)境條件、一過去的交互、有關(guān)一用戶的個人信息、一遠程計算機、和一與時間有關(guān)的條件在這些可替換的用戶部分之間的一文本定義分支。而且,再根據(jù)本發(fā)明的一優(yōu)選實施例,該交互式玩具設(shè)備還包括一內(nèi)容存儲單元,存儲經(jīng)該揚聲器待被播送給一用戶的至少一內(nèi)容標題的的音頻內(nèi)容,該至少一內(nèi)容標題是交互式的且包含交互分支。而且,再根據(jù)本發(fā)明的一優(yōu)選實施例,該至少一內(nèi)容標題包括多個內(nèi)容元素的并行部分,該多個內(nèi)容元素的并行部分包括至少兩個可替換的部分;和在這些可替換的部分之間的以一人性化方式的一文本定義分支。再根據(jù)本發(fā)明的一優(yōu)選實施例,該用戶信息存儲單元被至少部分地定位在該玩具中。而且,再根據(jù)本發(fā)明的一優(yōu)選實施例,該用戶信息存儲單元被至少部分地定位在該玩具外。而且,再根據(jù)本發(fā)明的一優(yōu)選實施例,該內(nèi)容存儲單元被至少部分地定位在該玩具中。而且,再根據(jù)本發(fā)明的一優(yōu)選實施例,該內(nèi)容存儲單元被至少部分地定位在該玩具外。再根據(jù)本發(fā)明的一優(yōu)選實施例,該用戶輸入接收器包括安裝在該玩具上的一麥克風,和接收自該麥克風輸入的一語句的一語音識別單元。再根據(jù)本發(fā)明的一優(yōu)選實施例,該用戶信息存儲單元進行工作以存儲有關(guān)各可用一唯一碼識別的多個用戶的個人信息且該內(nèi)容控制器進行工作以提醒任意用戶提供該用戶碼。而且,再根據(jù)本發(fā)明的一優(yōu)選實施例,該用戶信息存儲單元進行工作以存儲有關(guān)一用戶的合作行為的信息。再根據(jù)本發(fā)明的一優(yōu)選實施例,提供具有改變臉部表情的玩具設(shè)備,該玩具包括多特征化的臉部設(shè)備,該多特征化的臉部設(shè)備包括多個可多位置的臉部特征;和一臉部表情控制單元,其進行工作以至少生成代表至少兩個對應(yīng)的臉部表情的多個臉部特征的位置的三種組合。而且,再根據(jù)本發(fā)明的一優(yōu)選實施例,該臉部表情控制單元進行工作以使這些特征以不同的速率在多個位置之間變動,從而生成不同情緒的錯覺。而且,再根據(jù)本發(fā)明的一優(yōu)選實施例,該玩具設(shè)備還包括一揚聲器裝置、存儲一音頻聲明的一音頻存儲器、和進行工作以通過該揚聲器裝置控制該音頻聲明的輸出的一音頻輸出單元,且該臉部表情控制單元進行工作以與該聲明的輸出同步地生成多個位置的組合。再根據(jù)本發(fā)明的一優(yōu)選實施例,還提供有用于播放一交互式言語游戲的玩具設(shè)備,包括一玩具;安裝在該玩具上的一揚聲器裝置;安裝在該玩具上的一麥克風;接收自該麥克風輸入的一語句的一語音識別單元;和一音頻存儲單元,用于存儲通過該揚聲器裝置待被播放的多個言語游戲段和在這些言語游戲段之間的一文本存儲定義交互分支。再根據(jù)本發(fā)明的一優(yōu)選實施例,這些言語游戲段包括提醒一用戶生成對該言語游戲的一說出的輸入的至少一段。再根據(jù)本發(fā)明的一優(yōu)選實施例,該至少一段包括兩或更多的言語串和一對該用戶的提醒以再現(xiàn)這些言語串之一。再根據(jù)本發(fā)明的一優(yōu)選實施例,該至少一段包括一謎。再根據(jù)本發(fā)明的一優(yōu)選實施例,這些言語串中的至少一個具有教育內(nèi)容。再根據(jù)本發(fā)明的一優(yōu)選實施例,這些言語串中的至少一個包括有關(guān)在該游戲中的該用戶的行為的性質(zhì)對用戶的一個反饋。再根據(jù)本發(fā)明的一優(yōu)選實施例,該交互式玩具設(shè)備還包括與該玩具一起裝配的包括多個可多位置的臉部特征的多特征化臉部設(shè)備;和一臉部表情控制單元,其進行工作以至少生成代表至少兩個對應(yīng)的臉部表情的多個臉部特征的位置的三種組合。而且,再根據(jù)本發(fā)明的一優(yōu)選實施例,該臉部表情控制單元進行工作以使這些特征以不同的速率在多個位置之間變動,從而生成不同情緒的錯覺。而且,再根據(jù)本發(fā)明的一優(yōu)選實施例,該交互式玩具設(shè)備還包括存儲一音頻聲明的一音頻存儲器;和進行工作以通過該揚聲器裝置控制該音頻聲明的輸出的一音頻輸出單元,且該臉部表情控制單元進行工作以與該聲明的輸出同步地生成多個位置的組合。再根據(jù)本發(fā)明的一優(yōu)選實施例,該交互式玩具設(shè)備還包括安裝在該玩具上的一麥克風;接收自該麥克風輸入的一語句的一語音識別單元;和一音頻存儲單元,用于存儲通過該揚聲器裝置待被播放的一言語游戲的多個言語游戲段和在這些言語游戲段之間的一文本存儲定義交互分支。再根據(jù)本發(fā)明的一優(yōu)選實施例,這些言語游戲段包括提醒一用戶生成對該言語游戲的一說出的輸入的至少一段。再根據(jù)本發(fā)明的一優(yōu)選實施例,該至少一段包括兩或更多的言語串和一對該用戶的提醒以再現(xiàn)這些言語串之一。再根據(jù)本發(fā)明的一優(yōu)選實施例,該至少一段包括一謎。再根據(jù)本發(fā)明的一優(yōu)選實施例,這些言語串中的至少一個具有教育內(nèi)容。再根據(jù)本發(fā)明的一優(yōu)選實施例,還包括安裝在該玩具上的一麥克風;接收自該麥克風輸入的一語句的一語音識別單元;和一音頻存儲單元,用于存儲通過該揚聲器裝置待被播放的一言語游戲的多個言語游戲段和在這些言語游戲段之間的一文本存儲定義交互分支。再根據(jù)本發(fā)明的一優(yōu)選實施例,這些言語游戲段包括提醒一用戶生成對該言語游戲的一說出的輸入的至少一段。再根據(jù)本發(fā)明的一優(yōu)選實施例,該至少一段包括兩或更多的言語串和一對該用戶的提醒以再現(xiàn)這些言語串之一。另外或可替換地,該至少一段包括一謎。再根據(jù)本發(fā)明的一優(yōu)選實施例,這些言語串中的至少一個具有教育內(nèi)容。再根據(jù)本發(fā)明的一優(yōu)選實施例,這些言語串中的至少一個包括有關(guān)在該游戲中的該用戶的行為的性質(zhì)對用戶的一個反饋。根據(jù)本發(fā)明的一優(yōu)選實施例,還提供有一種玩具交互的方法,包括提供具有有趣的物理外觀的一玩具;提供安裝在該玩具上的一揚聲器;提供一用戶輸入接收器;將有關(guān)至少一用戶的信息存儲進一用戶信息存儲單元;并經(jīng)一響應(yīng)于經(jīng)該用戶輸入接收器接收的當前用戶輸入和該存儲單元中存儲的信息進行工作的內(nèi)容控制器,,經(jīng)該揚聲器提供音頻內(nèi)容給該用戶。再根據(jù)本發(fā)明的一優(yōu)選實施例,該存儲步驟包括存儲有關(guān)至少一用戶的個人信息并經(jīng)該內(nèi)容控制器使該音頻內(nèi)容人性化。再根據(jù)本發(fā)明的一優(yōu)選實施例,該存儲步驟包括存儲有關(guān)至少一用戶與該交互式玩具設(shè)備的交互的信息且根據(jù)存儲的有關(guān)該至少一用戶與該交互式玩具設(shè)備的過去的交互的信息經(jīng)該內(nèi)容控制器來控制該音頻內(nèi)容。再根據(jù)本發(fā)明的一優(yōu)選實施例,該方法還包括在一內(nèi)容存儲單元中存儲經(jīng)該揚聲器待被播送給一用戶的至少一內(nèi)容標題的的音頻內(nèi)容,該至少一內(nèi)容標題是交互式的且包含交互分支。再根據(jù)本發(fā)明的一優(yōu)選實施例,該方法還包括存儲有關(guān)各可用一唯一碼識別的多個用戶的個人信息且經(jīng)該內(nèi)容控制器提醒任意用戶提供該用戶碼。而且,再根據(jù)本發(fā)明的一優(yōu)選實施例,該方法還包括存儲有關(guān)一用戶的合作行為的信息。再根據(jù)本發(fā)明的一優(yōu)選實施例,該方法還包括提供多特征化的臉部設(shè)備,該多特征化的臉部設(shè)備包括多個可多位置的臉部特征;并至少生成代表至少兩個對應(yīng)的臉部表情的多個臉部特征的位置的三種組合。而且,再根據(jù)本發(fā)明的一優(yōu)選實施例,該方法還包括使這些特征以不同的速率在多個位置之間變動,從而生成不同情緒的錯覺。而且,再根據(jù)本發(fā)明的一優(yōu)選實施例,該方法還包括存儲一音頻聲明,并通過該揚聲器提供該音頻聲明,且與該聲明的輸出同步地生成多個臉部位置的組合。根據(jù)本發(fā)明的一優(yōu)選實施例,還提供有一種用于使用交互式對象,將編程教授給學生,例如學校的孩子們的系統(tǒng),該系統(tǒng)包括一計算機化的學生界面,允許一學生通過定義該交互式對象的特性賦與該交互式對象以生命,該計算機化學生界面進行工作以響應(yīng)于學生輸入至少部分地定義該交互式對象與人之間的交互;和一計算機化教師界面,允許一教師在定義該交互式對象的特性中監(jiān)視學生的進度。再根據(jù)本發(fā)明的一優(yōu)選實施例,該計算機化教師界面允許該教師配置該計算機化學生界面。根據(jù)本發(fā)明的一優(yōu)選實施例,還提供有一種用于將交互式對象的設(shè)計和編程教授給學生的教授系統(tǒng),該系統(tǒng)包括包括一計算機化的學生界面,允許一學生通過定義該交互式對象的特性賦與該交互式對象以生命,該計算機化學生界面進行工作以響應(yīng)于學生輸入至少部分地定義該交互式對象與人之間的交互;和一計算機化教師界面,允許一教師配置該計算機化學生界面。根據(jù)本發(fā)明的一優(yōu)選實施例,還提供有一種用于開發(fā)情緒上有知覺的計算機化的創(chuàng)造物的計算機系統(tǒng),包括一計算機化的用戶界面,允許一用戶通過定義一情緒上有知覺的計算機化的創(chuàng)造物與自然人之間的交互來開發(fā)該情緒上有知覺的計算機化的創(chuàng)造物,該交互至少包括該情緒上有知覺的計算機化的創(chuàng)造物對從該自然人提供的一刺激所導出的,指示自然人情緒的至少一參數(shù)的至少一響應(yīng);和一創(chuàng)造物控制單元,其進行工作以根據(jù)由該用戶定義的這些特性和交互來控制該情緒上有知覺的創(chuàng)造物。再根據(jù)本發(fā)明的一優(yōu)選實施例,該指示自然人情緒的參數(shù)包括除其語言內(nèi)容之外的自然人語句的特性。根據(jù)本發(fā)明的一優(yōu)選實施例,還提供有一種用于開發(fā)情緒上有知覺的計算機化的創(chuàng)造物的方法,該方法包括定義該情緒上有知覺的計算機化的創(chuàng)造物與自然人之間的交互,該交互至少包括該情緒上有知覺的計算機化的創(chuàng)造物對從該自然人提供的一刺激所導出的,指示自然人情緒的至少一參數(shù)的至少一響應(yīng);和根據(jù)由該用戶定義的這些特性和交互來控制該情緒上有知覺的創(chuàng)造物。根據(jù)本發(fā)明的一優(yōu)選實施例,還提供有一種用于將編程教授給學生的方法,該方法包括提供一基于計算機化的虛擬編程的學生界面,允許學生執(zhí)行虛擬編程;并提供一計算機化的教師界面,允許教師配置該計算機化的學生界面。還提供有一種情緒上有知覺的計算機化的創(chuàng)造物,包括多個交互模式,用于實現(xiàn)對應(yīng)的多個與自然人的交互,該多個交互至少包括對指示自然人情緒的至少一自然人情緒參數(shù)的一響應(yīng);和一情緒感知單元,用于從由該自然人提供的一刺激導出至少一自然人情緒參數(shù),并將該參數(shù)提供給多個交互模式中的至少一個;和任選地,一真實的或虛擬的,例如在屏幕上的,的物體,用于在多個交互模式中的至少一個中進行參與。附圖的簡要說明本發(fā)明將從以下參照附圖的詳細描述中被予理解且顯見。圖1A是形成根據(jù)本發(fā)明的一優(yōu)選實施例構(gòu)成并工作的一交互式玩具系統(tǒng)的至少一部分的一玩具的簡化視圖;圖1B使圖1的玩具的后視圖;圖2使圖1A和1B的玩具的部分切開視圖;圖3是圖1A和1B及2的玩具的元件的簡化分解視圖;圖4A、4B、4C、4D和4E是指示臉部表情變化的圖1A-3的玩具的視圖;圖5是本發(fā)明的一優(yōu)選實施例的交互式玩具設(shè)備的簡化方框圖;圖6是形成圖5的設(shè)備的部分的一基臺的功能方框圖;圖7是形成圖5的設(shè)備的部分的一玩具中安裝的一電路的功能方框圖;圖8A-8G結(jié)合在一起組成圖5的基礎(chǔ)通信單元62的概略性視圖圖8H-8N結(jié)合在一起組成根據(jù)一替換實施例的圖5的基礎(chǔ)通信單元62的概略性視圖;圖9A-9G結(jié)合在一起組成圖5的玩具控制裝置24的概略性視圖;圖9H-9M結(jié)合在一起組成根據(jù)一替換實施例的圖5的玩具控制裝置24的概略性視圖;圖10-15結(jié)合在一起組成圖1-9G的交互式玩具系統(tǒng)的一優(yōu)選的操作方法的簡化流程圖;圖16A和16B結(jié)合在一起形成由圖10的“播放”字模塊執(zhí)行的一文本的打開動作的一種可能實施方案的簡化的工作流程圖;圖17A-17E結(jié)合在一起形成由圖10的“播放”字模塊執(zhí)行的一故事文本的一種可能實施方案的簡化的工作流程圖;圖18A-18G結(jié)合在一起形成由圖10的“播放”字模塊執(zhí)行的一游戲文本的一種可能實施方案的簡化的工作流程圖;圖19A-19C結(jié)合在一起形成由圖10的“播放”字模塊執(zhí)行的一歌曲文本的一種可能實施方案的簡化的工作流程圖;圖20A-20C結(jié)合在一起形成由圖10的“播放”字模塊執(zhí)行的圖17A-17E的“BunnyShort”故事文本的一種可能實施方案的簡化的工作流程圖;圖21A-21F結(jié)合在一起形成由圖10的“播放”字模塊執(zhí)行的圖17A-17E的“兔子長片”故事文本的一種可能實施方案的簡化的工作流程圖;圖22是在圖17D、18C、19B和19C中所涉及的“主題部份”的簡化的工作流程圖;圖23A是根據(jù)本發(fā)明的一優(yōu)選實施例的一真實玩具活創(chuàng)造物的開發(fā)和操作的視圖;圖23B是根據(jù)本發(fā)明的一優(yōu)選實施例的一虛擬活創(chuàng)造物的開發(fā)和操作的視圖;圖23C是對圖23A-23B的系統(tǒng)進行變化的一系統(tǒng)的簡化的半插圖半方框圖的視圖,其中設(shè)置一遠程內(nèi)容服務(wù)器,其對在將生命賦與一計算機化的活創(chuàng)造物中有用的數(shù)據(jù)、程序、聲音、文件和其他內(nèi)容提供服務(wù);圖24A是一學生編程一計算機化的活創(chuàng)造物的視圖;圖24B是人與一計算機化的活創(chuàng)造物至少進行言語交互的視圖,其中該交互如上所述參照圖24A地由學生進行編程;圖24C是裝備有攝像機和例如液晶顯示器(LCD)的視頻顯示器中的一構(gòu)件的一創(chuàng)造物的視圖;圖25是一系統(tǒng)管理員的優(yōu)選功能性的簡化的軟件設(shè)計視圖;圖26是例如圖23A-23C的系統(tǒng)的一用于教授交互式計算機化的構(gòu)造的開發(fā)的系統(tǒng)中的教師工作站312的優(yōu)選功能性的簡化的軟件視圖;圖27是例如圖23A-23C的系統(tǒng)的一用于教授交互式計算機化的構(gòu)造的開發(fā)的系統(tǒng)中的學生工作站10的優(yōu)選功能性的簡化的軟件視圖;圖28-31是作為用于可視編程塊840840的一人界面的部分的屏幕顯示的例子;圖32是包括一投射的狀態(tài)機器圖的例子的圖示的屏幕顯示;圖33是使學生建立一環(huán)境的屏幕顯示,其中一先前生成的模塊可被測試;圖34-37是圖23A、23B或23C中任一的教師工作站312給出的屏幕顯示的例子;圖38是學生典型地使用圖23A、23B或23C中任一的學生工作站的過程的簡化的流程圖;圖39是通過在該學生工作站310中的插入目錄中的選擇事件(Event)所生成的一屏幕顯示的例子;圖40是通過在該學生工作站310中的插入目錄中的選擇功能(Function)所生成的一屏幕顯示的例子;圖41是在執(zhí)行圖38的步驟910和920的過程中由學生執(zhí)行的處理的簡化的流程圖;圖42是一情緒交互作用流程設(shè)計過程的簡化的流程圖;圖43-102是根據(jù)本發(fā)明的一優(yōu)選實施例構(gòu)成并工作的一計算機化的編程教授系統(tǒng)的優(yōu)選實施例的視圖;圖103是一情緒分析數(shù)據(jù)庫的表格圖;圖104是一情緒分析狀態(tài)圖;圖105是典型的功能呼叫和回呼通知視圖;圖106是適用于一媒體BIOS模塊的典型的輸入數(shù)據(jù)處理視圖;圖107是適用于一UCP實現(xiàn)模塊的典型的輸入數(shù)據(jù)處理視圖;圖108是適用于用戶應(yīng)用和一API模塊的典型的數(shù)據(jù)處理視圖;圖109是一典型的UCP實現(xiàn)模塊和媒體BIOS輸出數(shù)據(jù)處理視圖;圖110是用于可以協(xié)議實現(xiàn)模塊和媒體BIOS模塊的輸出數(shù)據(jù)處理視圖;圖111是典型的圖形構(gòu)成的視圖;及圖112-115是典型的安裝—檢驗(分別為BT1/4,2/4,3/4和4/4)視圖。這里附有以下的附錄,其目的在于理解和評定所示出及所描述的本發(fā)明的一優(yōu)選實施例附錄A是本發(fā)明的交互式玩具系統(tǒng)的一優(yōu)選的軟件實現(xiàn)的計算機目錄;附錄B是用于圖8A-8G的設(shè)備的一優(yōu)選的部分目錄;及附錄C是用于圖9A-9G的設(shè)備的一優(yōu)選的部分目錄。優(yōu)選方案的詳細描述現(xiàn)在參照圖1A。圖1A是一個簡化的玩具圖,一般情況下,本發(fā)明將一個玩具標記為10。玩具10至少為所建造的交互玩具系統(tǒng)的一個組成部分,其操作符合本發(fā)明所優(yōu)選的一個具體實現(xiàn)。盡管玩具10能夠以多種物理配置加以實現(xiàn),并仍可保持此處所描述的交互玩具系統(tǒng)的各種功能,但為了便于說明,圖1A中僅顯示了一個典型的玩具10,這一玩具10具有一個奇特的物理外觀,并包括一個擁有一系列附件(例如胳膊14、腿16、眼瞼17、眼睛18、鼻子19以及嘴20)的身體部分12。胳膊14和腿16可能是被動的″附件″,即可將它們配置為不可移動的,但眼瞼17、眼睛18和嘴20可以是″活躍的″附件,即可將它們配置為可移動的。以下將參照圖3~4E對此進行較為詳細的描述。圖1B是圖1中所示玩具的一個背視圖,而且還把玩具10典型地顯示為一個具有有孔區(qū)22的玩具,在孔區(qū)22的后面可安裝一個揚聲器,以下將對此更詳細地加以描述。圖2是圖1A和1B所示玩具的局部剖面圖,顯示了玩具控制設(shè)備24(通常安置在身體部分12中)和一系列用戶輸入接收器(例如那些位于胳膊14和腿16中用以接收觸覺用戶輸入的開關(guān)26)以及一個用于接收音頻用戶輸入的麥克風28。應(yīng)明白允許把此處所描述的各種用戶輸入接收器定位在玩具10中的任何地方,例如鼻子19之后,只要它們能夠根據(jù)要求由觸覺和音頻用戶輸入(例如話音輸入)加以訪問即可。應(yīng)明白,令大量人們所知的傳感器和輸入設(shè)備(例如加速度測量器、方向傳感器、接近傳感器、溫度傳感器、視頻輸入設(shè)備等)中的任何一種(盡管并沒有特別示出)都可并入玩具10,用以接收輸入或其它刺激,從而并入此處所描述的針對本發(fā)明的交互式玩具系統(tǒng)的交互環(huán)境中。現(xiàn)在,請再次參照圖3。圖3是圖1A、1B以及2中所示玩具10的各部件的簡化分解圖。圖1所示身體部分12的面部部分30在圖3中與鼻子19和嘴20一起加以顯示,并擁有2個孔32,用以容納眼瞼17和眼睛18。面部部分典型地位于保護蓋34的頂部,保護蓋34安裝在保護盒36上。眼瞼17、眼睛18以及嘴20,每一個都典型地與運動部件38相配合,運動部件38向每一附件提供了一個動作。運動部件38典型地由一個齒輪盤40所驅(qū)動,而該盤由一個齒輪傳動軸42和電機44加以控制。通過一個相應(yīng)的運動部件38,電路24實現(xiàn)了一個具體附件所希望的一個運動,即取決于齒輪傳動裝置平臺40相對于當前轉(zhuǎn)動方向的所希望的轉(zhuǎn)動方向控制電機44和齒輪傳動軸42,以定向和移動齒輪傳動裝置平臺40,齒輪盤40的方向是由光定位設(shè)備46所決定的。更可取的做法是,令齒輪傳動裝置平臺40有選擇地與運動部件38中一個單一的運動部件在某一時刻協(xié)作,而該選擇時刻依賴于齒輪傳動裝置平臺40的具體轉(zhuǎn)動方向。另外還提供了一個針對音頻輸出的揚聲器。能量典型地由電源48(通常為一個DC電源)加以提供。圖4A、4B、4C、4D以及4E是對圖1A~3所示玩具10的面部表情變化的圖示說明。圖4A顯示的是按箭頭50所指示的方向加以轉(zhuǎn)動的眼睛18。圖4B顯示的是按箭頭52所指示的方向加以轉(zhuǎn)動的眼睛18。圖4C顯示的是已呈半閉狀態(tài)的眼瞼17,而圖4D顯示的是全閉狀態(tài)的眼瞼17。圖4E顯示的是按箭頭54和箭頭56所指示方向加以移動的嘴唇20。應(yīng)明白,嘴20既可移動一片嘴唇也可移動兩片嘴唇。現(xiàn)在請參照圖5。圖5是按照本發(fā)明的一個優(yōu)選的具體方案所構(gòu)造并可在這一方案中加以運作的交互式玩具設(shè)備的一個簡化的結(jié)構(gòu)圖。這一方案典型地提供了一臺計算機60,例如一臺基于Intel公司PENTIUM微處理器的個人計算機,通過RS-232串行通信端口與一個基礎(chǔ)通信單元62(典型地為一個基于無線電的單元)進行通信。通過并行端口、聲卡的MIDI和音頻端口、USB端口或任何為人們所熟悉的通信端口,可實現(xiàn)計算機60和基礎(chǔ)單元62之間的通信。單元62典型地由電力供給裝置64提供能量,這一電力供給裝置可由一個AC電源供電。更好的方案是,令單元62包括一個天線66,用于與玩具10(圖2)的玩具控制設(shè)備24進行通信,相類似,玩具控制設(shè)備24也應(yīng)裝備天線68。玩具控制設(shè)備24典型地控制電機44(圖3)、開關(guān)26(圖2)、一或多個用于檢測玩具10的動作的運動傳感器70、麥克風28(圖2)、揚聲器58(圖3)。部件24、44、26、28、58以及70中的任何一個,均可由電源48(圖3)提供能量。計算機60典型地提供了用戶信息存儲機制,例如,在一個硬磁盤上或在任何一個為人們所熟悉的、更為理想的非易失性存儲媒體上,用以存儲與用戶相關(guān)的信息,例如用戶的個人信息,這些信息包括用戶名、一個唯一的用戶代碼(本發(fā)明將其稱為″秘密名″,秘密名可能是用戶的一個虛構(gòu)名或其它奇異的名,典型地由用戶預(yù)定義或選擇)以及用戶的年齡等。計算機60還可做為本發(fā)明所稱的″內(nèi)容控制器″。作為內(nèi)容控制器,計算機60可識別與玩具10交互的用戶、對通過玩具10(例如通過揚聲器58)的控制內(nèi)容的選擇與輸出,以下將會更詳細地加以描述。內(nèi)容控制器可利用與用戶相關(guān)的信息,人性化那些提交給用戶的音頻內(nèi)容,例如通過使用用戶的秘密名來稱呼用戶,或以一種適合于用戶性別的方式與用戶交談。計算機60還典型地可為存儲內(nèi)容標題提供內(nèi)容存儲,每一個內(nèi)容標題包括一個或多個內(nèi)容元素,用于響應(yīng)通過以上描述的玩具10的用戶輸入接收器所接收到的用戶輸入、環(huán)境輸入、或隨機的輸入。例如,一個內(nèi)容標題可以是一個笑話、一個謎語或一個交互故事。一個交互故事可以包括許多內(nèi)容元素,例如音頻元素,通常情況下安排在一個用于順序輸出的腳本中。交交互故事典型地被劃分為多個內(nèi)容元素序列部分,而且把多個部分并行加以安排,以代表故事中每一點的可選的交互分支。內(nèi)容控制器可根據(jù)玩具10的當前用戶輸入、先前的分支選擇、或其它用戶信息(例如過去的交互、用戶的偏好、性別、環(huán)境或瞬時狀態(tài)等)選擇一個分支。計算機60可通過各種人們所熟悉的裝置(例如通過與BBS或與Internet固定或撥號的連接)與一或多臺其它的計算機(例如一臺遠程計算機)進行通信。計算機60可實時地或通過一個后臺或批處理過程,從遠程服務(wù)器上下載各種類型的內(nèi)容信息,例如全新的內(nèi)容標題、現(xiàn)存標題的附加部分或內(nèi)容元素(例如腳本和話音文件)、一般化的信息(例如天氣預(yù)報信息和廣告以及教育材料)。從一臺遠程計算機那里所下載的信息,先前可能曾經(jīng)針對某一特定用戶進行過定制化處理,例如根據(jù)年齡、用戶的地址、購買習慣、受教育水平以及現(xiàn)存的用戶信譽所進行的定制化處理。內(nèi)容控制器也可記錄和存儲從某一用戶那里接收來的用戶信息,用戶信息是通過用戶輸入接收器(例如話音的或其它音頻用戶輸入)加以接收的。計算機60包括語音識別能力,這一能力典型地通過硬件與/或軟件,例如″AutomaticSpeechRecognitionSoftwareDevelopmemtKit(自動語音識別軟件開發(fā)工具)3.0版″,(可從Lernout&amp;Hauspie話音產(chǎn)品、Sint-Krispisnstraat7、8900Leper以及Belgium),加以實現(xiàn)。語音識別可為內(nèi)容控制器加以使用,用于分析來自用戶的話音輸入,以確定用戶的選擇,例如在與某一交互故事的連接中,以選擇該故事的一個分支。內(nèi)容控制器還可把語音識別能力用于對用戶的識別,即由用戶講出秘密名或代碼,并由麥克風28加以接收,從而實現(xiàn)對用戶的識別。內(nèi)容控制器還可提供對面部表情的控制。通過使面容的各部分以不同的速率在不同位置之間振動,面部機制(圖5)可以提供復雜的和動態(tài)的面部表情。更理想的方案是,令面容的每一個部分至少擁有兩個假設(shè)的位置。通常情況下,兩個或更多的面容部分可在同一時刻以不同的速率,移向不同位置,以便提供一系列面部表情的組合,從而可產(chǎn)生各種不同的感情。更可取的是,內(nèi)容控制器可控制面部特征的組合,與用戶的交互或內(nèi)容的輸出同步發(fā)生,以提供一個自然的伴隨表情,例如嘴唇的同步和眼睛的自然轉(zhuǎn)動。更理想的方案是,內(nèi)容控制器可記錄那些與提供給用戶的內(nèi)容相關(guān)的信息以及與每一用戶同玩具10之間的交互相關(guān)的信息,例如給每一用戶所講的具體的笑話和為每一用戶所唱的具體的歌曲、用戶對提示(例如問題或謎語或交互故事以及其它用戶輸入)的響應(yīng)與選擇。內(nèi)容控制器可把與每一用戶過去交互相關(guān)的信息,用于相繼內(nèi)容的選擇和輸出,另外還可適當?shù)乜刂仆婢?0(例如當與一個先前并沒有同當前用戶玩過游戲的用戶玩游戲),或影響交互的復雜度。最好能夠把計算機60安置在玩具10內(nèi)或物理地與玩具10組裝在一起,以致于計算機60能夠直接與玩具控制設(shè)備24進行通信,而不必通過基礎(chǔ)單元62和天線66及68,例如通過有線裝置或光無線通信方法。另外,也可把計算機60電子地與玩具控制設(shè)備24集成在一起。圖6是圖5所示的基礎(chǔ)通信單元62的一個功能結(jié)構(gòu)圖。單元62典型地包括一個微控制器單元72,這一微控制器單元擁有一個內(nèi)存74,單元72可通過一個適配器76與圖5所示的計算機60進行通信,并典型地通過一個RS-232端口或如以上所述的其它形式與計算機60相連(參見圖5)。單元72通過發(fā)送接收機78和天線66與玩具10(圖2)的玩具控制設(shè)備24進行通信。發(fā)送接收機78通常為一無線電發(fā)送接收機。圖7是圖5所示的玩具控制設(shè)備24的一個功能結(jié)構(gòu)圖。設(shè)備24典型地包括一個微控制器單元82,它可通過一個發(fā)送接收機84(典型地為一無線電發(fā)送接收機)和天線68與圖5所示的基礎(chǔ)單元72進行通信。能量是由一個電力供給裝置86加以提供的,電力供給裝置86由電源48(圖5)提供電能。更可取的做法是,讓單元82控制與/或接收來自玩具接口模塊88的輸入,而玩具接口模塊88將控制與/或接收來自如以上所描述的揚聲器、麥克風、傳感器、以及電機的輸入。發(fā)送接收機84可以附加地或交替地與接口模塊88進行通信,以實現(xiàn)麥克風輸入和揚聲器輸出的直接通信?,F(xiàn)在參照圖8A~8G。圖8A~8G共同構(gòu)成圖5所示基礎(chǔ)通信單元62的一個示意圖。附錄B是圖8A~8G所示裝置的一張優(yōu)選零件的列表。圖8H~8N共同構(gòu)成圖5所示的基礎(chǔ)通信單元62的另一可選方案的示意圖。現(xiàn)在參照圖9A~9G。它們共同構(gòu)成圖5所示玩具控制設(shè)備24的一個示意圖。附錄C是圖9A~9G所示裝置的一個優(yōu)選零件的列表。圖9H~9M共同構(gòu)造圖5所示玩具控制設(shè)備24的另一可選方案的示意圖?,F(xiàn)在參照圖10~15。它們共同構(gòu)成圖1~9G所示交互玩具系統(tǒng)的一個優(yōu)選的操作方法的簡化流程圖。應(yīng)明白,圖10~15所示的方法可部分地由計算機硬件和部分地由軟件或全部由定制化的硬件加以實現(xiàn)??扇〉淖龇ㄊ?,令圖10~15所示的方法作為由計算機60(圖5)所執(zhí)行的軟件指令加以實現(xiàn)。應(yīng)明白,圖10~15所示的方法以及以下所描述的其它方法,不必以一種特定的順序加以執(zhí)行。事實上,出于實現(xiàn)上的原因,這些方法的某一具體實現(xiàn)很可能會按不同于另一個特定實現(xiàn)的順序加以實現(xiàn)。圖10描述了主要的軟件模塊以及相應(yīng)的高層部件。操作典型地開始于接通可與基礎(chǔ)單元62進行通信的通信端口,并通過基礎(chǔ)單元62初始化計算機60與玩具控制設(shè)備24之間的通信。主模塊還初始化一個語音識別引擎,并顯示(典型地通過計算機60的顯示器)用于以選擇各種子模塊的程序的主菜單。主模塊典型地包括下列子模塊1)″關(guān)于你的信息″是一個子模塊,它可使用戶根據(jù)用戶的偏好配置該系統(tǒng),即用戶可通過裝入相應(yīng)的參數(shù),例如用戶的真實姓名、秘密名、出生日期、頭發(fā)與眼睛的顏色、性別、以及通常睡覺與起床的時間等,對系統(tǒng)加以配置。2)″跟著唱″是另一個子模塊,它提供了具體的內(nèi)容,例如允許用戶跟著一起唱的歌曲。3)″如何玩玩具″是一個教學子模塊,它可教用戶如何使用這一系統(tǒng)以及如何玩玩具10。4)″玩玩具″是一個子模塊,它可把交互內(nèi)容提供給玩具10,并指導玩具10與用戶進行交互。5)″檢查玩具″是一個子模塊,它可幫助用戶解決與該系統(tǒng)的操作相關(guān)的技術(shù)問題,例如當玩具的電池能量偏低和無法向基站提供足夠的電力時應(yīng)怎么辦,以及6)″退出″是一個子模塊,它能夠使用戶停止交互玩具系統(tǒng)軟件的操作,并將其從計算機內(nèi)存中加以清除。圖11更詳細地說明了圖10所示″接通通信″步驟的一個優(yōu)選的實現(xiàn)。典型的操作開始于對典型的系統(tǒng)參數(shù)(例如設(shè)置對各存儲單元的文件系統(tǒng)的存取)的初始化。接下來的操作,將是加載顯示元素、接通數(shù)據(jù)庫、初始化玩具和通信驅(qū)動程序、初始化語音識別軟件引擎,并為各種并行操作的活動創(chuàng)建獨立的線程以便一個用戶在與玩具交互的同時,另一個用戶也可以把計算機屏幕和鍵盤用于其它應(yīng)用,例如文字處理。圖12更詳細地顯示了圖10所示″關(guān)于你的信息″子模塊的一個優(yōu)選的實現(xiàn)。典型的操作開始于當用戶在計算機屏幕的主菜單上選擇了″關(guān)于你的信息″選項時。然后提示用戶,請用戶表明他是一個現(xiàn)存的用戶還是一個新的用戶。接下來,由用戶提供用戶標識,并繼續(xù)進入一個注冊步驟。圖12中所示的部分或全部操作可根據(jù)玩具的話音指示加以執(zhí)行。圖13更詳細地顯示了圖12所示注冊階段的一個優(yōu)選的實現(xiàn)。典型的操作開始于加載一個注冊數(shù)據(jù)庫、選擇一個秘密名,然后選擇和修改顯示在計算機屏幕上的參數(shù)。當選擇退出選項時,用戶返回到圖10所描繪的主菜單。圖14更詳細地顯示了圖10所示″跟著唱″子模塊的一個優(yōu)選的實現(xiàn)。典型的操作開始于在計算機的屏幕上顯示一部電影,并同時使(在基礎(chǔ)單元的通信范疇內(nèi))所有玩具10通過它們的揚聲器提供音頻內(nèi)容,例如電影的插曲。用戶可以(例如通過鍵盤鍵入)選擇前進到下一首歌曲或退出這一模塊,并返回到主模塊。圖15顯示了圖10所示的″如何玩玩具″和″玩玩具″子模塊的一個優(yōu)選的實現(xiàn)。典型的操作開始于對所希望的腳本的初始化(以下將對此更詳細地加以描述)、最小化計算機屏幕上的狀態(tài)窗口、關(guān)閉線程、并返回到主菜單。計算機繼續(xù)操作負責玩具運行的線程,并繼續(xù)并行地在計算機屏幕上顯示通信媒體的狀態(tài)和腳本。現(xiàn)在請參照圖16A和16B,它們共同構(gòu)成由圖10所示″Play--玩玩具″子模塊所執(zhí)行的一個腳本的打開動作的一種可能的實現(xiàn),簡化的操作流程圖。與下列的動作識別符和動作相結(jié)合,可更好地理解圖16A和16B的實現(xiàn)。打開<播放上表中標識為Op002的話音文件,圖16A和16B所示方法的典型操作將開始進行。這可典型地通過指示玩具開始接受一個特定時間長度的話音文件得以實現(xiàn)。接下來,從計算機的存儲單元中讀出這一話音文件,并通過無線電基站與玩具控制設(shè)備進行通信。玩具控制設(shè)備把所接收的無線電輸入與玩具的揚聲器連接起來,無線電輸入將通過玩具的揚聲器加以輸出。話音文件op002請求用戶按壓位于玩具鼻子或腳上的微開關(guān)。如果用戶按下微開關(guān),則腳本程序?qū)^續(xù)播放話音文件op015m、op020m或op025m,每一個文件都按照當前日期時間歡迎用戶,然后請求用戶說出他或她的秘密名,以向系統(tǒng)標識他或她自己。接下來,腳本程序用三秒鐘的時間記錄用戶的話音響應(yīng)。記錄工作是由計算機來完成的,即計算機將向玩具發(fā)送一條命令,命令玩具把玩具的麥克風與玩具無線電發(fā)射機連接在一起,并用三秒鐘的時間發(fā)射所接收的音頻輸入。無線電通信由無線電基站加以接收,傳送給計算機,并作為一個文件存儲在計算機的存儲單元中。接下來應(yīng)用軟件根據(jù)所記錄的文件執(zhí)行語音識別。然后把語音識別過程的結(jié)果返回給腳本程序。腳本程序根據(jù)用戶的響應(yīng),繼續(xù)播放一條對應(yīng)于所標識秘密名的人性化的歡迎消息,或播放另一條有關(guān)識別工作未能成功進行的消息。這一歡迎消息還請求用戶在多個選項(例如一個故事、一個游戲或一首歌曲)之間加以選擇。用戶的選擇是通過記錄用戶的話音響應(yīng)和執(zhí)行語音識別加以接收的。圖17A~17E、18A~18G以及19A~19C分別更詳細地描述了一個故事、一個游戲和一首歌曲的簡化的優(yōu)選的實現(xiàn)。圖17A~17E共同構(gòu)成了圖10所示″Play--玩玩具″子模塊所執(zhí)行的一個故事腳本的一個可能的實現(xiàn)的一個簡化的操作流程圖。與下列的動作識別符和動作聯(lián)系在一起,將可更好地理解圖17A~17E的實現(xiàn)故事菜單圖18A~18G共同構(gòu)成了由圖10所示″Play--玩玩具″子模塊所執(zhí)行的一個游戲腳本的可能的實現(xiàn)的一個簡化的操作流程圖。與下列動作標識符及動作相結(jié)合,將會對圖18A~18G所示的實現(xiàn)有更好的理解游戲菜單<<>圖19A~19C共同構(gòu)成由圖10所示″PLAY--玩玩具″子模塊所執(zhí)行的一個歌曲腳本的可能的實現(xiàn)的一個簡化的操作流程圖。如果與下列的動作標識符和動作相結(jié)合,可對圖19A~19C的實現(xiàn)更好地加以理解唱歌菜單<圖20A~20C共同構(gòu)成圖17A~17E所示″兔子短片″故事腳本的一個可能的實現(xiàn)的一個簡化的操作流程圖,并由圖10所示的″玩玩具″子模塊加以執(zhí)行。與下列的動作標識符和動作相結(jié)合,可對圖20A~20C的實現(xiàn)更好地加以理解兔子短片圖21A~21F共同構(gòu)成圖17A~17E所示″BunnyLong″故事腳本的一種可能的實現(xiàn)的一個簡化的操作流程圖,它由圖10所示的″Play--玩玩具″子模塊加以執(zhí)行。對照下列的動作標識符和動作列表,可以更好地對圖21A~21F所示的實現(xiàn)加以理解兔子長命圖22是圖17D、18C、19B以及19C所涉及的″ThemeSection--主題部分″的一個簡化的操作流程圖。主題部分向用戶提供了對整個應(yīng)用的一個總的介紹和一個教學部分。附錄A是以上所述交互式玩具系統(tǒng)的一個優(yōu)選的軟件實施例計算機列表。本發(fā)明的交互式玩具系統(tǒng)軟部件的一個優(yōu)選的實現(xiàn)方法描述如下1)提供一臺可運行WINDOWS95操作系統(tǒng)的計算機;2)附錄A中如下標記的源代碼*InstallationSourceCode(安裝源代碼)*ApplicationSourceCode(應(yīng)用源代碼)*針對語音識別的ActiveX源代碼*CREAPI.DLL*CRPRO.DLL*BASEIO.DLL*ToyConfigurationSourceCode(玩具配置源代碼)編譯成可在步驟1)中所提供的計算機上執(zhí)行的相應(yīng)的可執(zhí)行文件;3)安裝針對WINDOWS95的″AutomaticSpeechRecognitionSoftwareDevelopmemtKit(自動語音識別軟件開發(fā)工具)3.0版″,來自Lernout&amp;Hauspie話音產(chǎn)品、Sint-Krispisnstraat7、8900Leper、Belgium。4)把附錄A中以如下標記的源代碼*BaseStationSourceCode(基站源代碼)*ToyControlDeviceSourceCode(玩具控制設(shè)備源代碼)編譯成相應(yīng)的可執(zhí)行的文件,并分別安裝進圖5所示的基礎(chǔ)通信單元62和圖5所示的玩具控制設(shè)備24中。5)運行對應(yīng)于InstallationSourceCode(安裝源代碼)的可執(zhí)行文件。6)運行對應(yīng)于ToyConfigurationSourceCode(玩具配置源代碼)的可執(zhí)行文件。7)運行對應(yīng)于ApplicationSourceCode(應(yīng)用源代碼)的可執(zhí)行文件。應(yīng)明白,這里所展示和所描述的交互式玩具系統(tǒng)的操作,不僅考慮到普通日期的情況,而且也將考慮到諸如節(jié)假日以及孩子的生日等日歷信息,例如玩具可以在孩子的生日輸出特殊的消息,或可在夜晚生成一個″疲勞的″面部表情。較理想的做法是,至少這里所展示和所描述的玩具裝置的某些處理功能可由一臺通用的或家庭計算機(例如一臺PC)加以提供,并使這一計算機能夠以任何合適的方式與玩具裝置進行通信,典型地為無線通信,例如無線電通信。更可取的方案是,一旦玩具得以建立,包含玩具處理功能的PC程序運行在后臺方式中,允許其它用戶,例如成人在孩子們玩玩具的同時,把家庭計算機用于他們自己的其它應(yīng)用。與本發(fā)明共有未決的PCT申請--PCT/IL96/00157、共有未決的以色列的專利申請--121574以及共有未決的以色列的專利應(yīng)用--121642,描述了一些在生成計算機化的玩具過程中使用的技術(shù)與裝置,本發(fā)明把它們所公布的技術(shù)與裝置并入此處,以作參考。在本專利文檔的公布中,有一個其所包含的內(nèi)容必須得到知識產(chǎn)權(quán)保護的部分。若本專利文檔或?qū)@贾械哪骋患夹g(shù)或裝置出現(xiàn)在美國專利和商標局的專利文件或記錄中,則知識產(chǎn)權(quán)的擁有者不反對按本專利文檔或?qū)@紝@一技術(shù)或裝置進行精確的復制,除此之外,知識產(chǎn)權(quán)的擁有者保留所有技術(shù)或裝置的知識產(chǎn)權(quán)。在本發(fā)明的說明書和權(quán)力要求書中,術(shù)語″計算機化的創(chuàng)造物″或″計算機化的活的創(chuàng)造物″用于表示那些可由計算機控制的創(chuàng)造物,它們既可以是存在于計算機屏幕上的虛擬的創(chuàng)造物,也可以是具有實際、有形身驅(qū)的物理的玩具創(chuàng)造物。一個創(chuàng)造物既可以是創(chuàng)造物,也可以是人,甚至可以是其它形式的物體。″把生命賦予″一個創(chuàng)造物,指的是把類生命的行為賦予創(chuàng)造物,典型地通過定義自然人與該創(chuàng)造物至少一個交互加以實現(xiàn)。從創(chuàng)造物的角度來看,更理想的做法是,這一交互包括由那些由自然人所表露的情感的覺察。一個″自然人″指的是一個由上帝所創(chuàng)造的人,且在傳統(tǒng)世界的感覺上是活的,而不是針對虛擬人、玩具人以及玩具娃娃等?,F(xiàn)在參照圖23A~23B,它們共同說明了符合本發(fā)明的一個優(yōu)選實施例的一個計算機化的活的創(chuàng)造物的開發(fā)與操作。圖23A顯示了一個物理的創(chuàng)造物,而圖23B顯示了一個虛擬的創(chuàng)造物。如圖23A和23B所示,它們提供了一個用于教授交互計算機化結(jié)構(gòu)開發(fā)的教學設(shè)施,典型地包括一系列學生工作站310和一臺教師工作站312,它們通過一條總線314與一臺教學設(shè)施服務(wù)器316互連。教學設(shè)施服務(wù)器316可向教師工作站312和學生工作站310提交適當?shù)膬?nèi)容。更可取做法是,提供一臺創(chuàng)造物生命服務(wù)器318(這里也稱作″創(chuàng)造物支持服務(wù)器″或″創(chuàng)造物生命支持服務(wù)器″)。如以下所描述的,這一服務(wù)器為一個創(chuàng)造物324提供了由學生編程的類生命的功能。也可把服務(wù)器316和318合并為一臺單一的服務(wù)器。作為進一步的選擇,可提供多臺創(chuàng)造物支持服務(wù)器318,每一臺支持一個或多個計算機化的活的創(chuàng)造物。還有一種選擇(未在圖中加以顯示)是,提供一臺單一的中央計算機,學生和教師工作站可由那些通過中央計算機加以支持的終端組成。如圖23A所示,理想的方案是,把創(chuàng)造物生命支持服務(wù)器318與一個計算機無線電接口320相藕合,而這一接口最好與一個在計算機化的活的創(chuàng)造物324中的一個相應(yīng)的控制器322進行無線通信,由此對計算機化的活的創(chuàng)造物324的動作與響應(yīng)加以控制和存儲,以及最好把其內(nèi)部化的經(jīng)驗加以保存與分析。由創(chuàng)造物生命服務(wù)器318所提供的計算機化的活的創(chuàng)造物324具有一系列不同的擬人的感覺,例如聽覺、視覺、觸覺、溫感、位置感和最好這些感覺的合成以及可由學生編程的感覺,例如觸摸的感覺,這些感覺可通過適當?shù)呐c計算機化的活的創(chuàng)造物相關(guān)連的音頻、視頻、接觸、溫度以及位置傳感器來提供這些感覺。另外,按照本發(fā)明的一個優(yōu)選的實施例,計算機化的活的創(chuàng)造物324被賦予一系列擬人的表達方式,例如言語、動作、面部表情以及各種表達方式的組合形式,例如高興、生氣、悲傷以及驚訝等。這些表達結(jié)構(gòu)可通過利用適當?shù)臋C械和電子機械驅(qū)動器而得以實現(xiàn),并可通過創(chuàng)造物生命服務(wù)器318根據(jù)學生的程序得以生成?,F(xiàn)在參照圖23B??梢钥闯?,一個虛擬的計算機化的活的創(chuàng)造物可以在計算機338的顯示器336上得以創(chuàng)建,計算機338可直接或通過網(wǎng)絡(luò)(例如Internet)與總線314相連。更可取的做法是,為虛擬的計算機化的活的創(chuàng)造物334賦予一系列不同的擬人感覺,例如聽覺、視覺、觸覺、溫感、位置感,最好還賦予這些感覺的合成,例如觸摸感。建議的做法是,通過把麥克風340、照相機342、觸摸墊或其它觸摸輸入設(shè)備344與計算機338相關(guān)聯(lián),來提供這些感覺。更理想的是,還可把一個揚聲器346與計算機338關(guān)聯(lián)在一起。服務(wù)器348典型地既可執(zhí)行圖23A所示的教學設(shè)施服務(wù)器316的功能,也可執(zhí)行圖23A所示的創(chuàng)造物生命服務(wù)器318的功能。另外,根據(jù)本發(fā)明所優(yōu)選的實施例,需賦予虛擬的計算機化的活的創(chuàng)造物334一系列擬人的表達方式,例如言語、動作、面部表情以及各種表達方式的組合形式,例如高興、生氣、悲傷以及驚訝等。它們是由適當?shù)膫鹘y(tǒng)計算機技術(shù)加以實現(xiàn)的。本發(fā)明一個較好的特性是,在計算機化的活的創(chuàng)造物以及在與其交互的人這兩個方面,都能通過適當?shù)木幊?,基于以上所提到的擬人的感覺和表達方式,為計算機化的活的創(chuàng)造物提供與人的交互能力。更可取的是,能夠令這些交互包括上述感覺的組合及表達方式的組合。圖23C是圖23A~23B所示系統(tǒng)的一個衍生系統(tǒng)的半圖示、半結(jié)構(gòu)化的簡化圖。該系統(tǒng)提供了一臺遠程內(nèi)容服務(wù)器340,提供把生命賦予創(chuàng)造物324所用的數(shù)據(jù)、程序、話音文件以及其它內(nèi)容。圖24A是學生利用其中一臺仿真顯示器對該創(chuàng)造物進行編程的圖形表示,編程是通過該學生與該學生的工作站310交互作用來實施的。這種交互可以是語言的或可以通過其它合適的輸入設(shè)備如鍵盤或鼠標來完成。在說話以及“停止”之前的命令“播放記錄”意思是該學生工作站應(yīng)在“播放記錄”之后記錄由該學生發(fā)出的說話內(nèi)容,直到“停止”但不包括“停止”,并把說話內(nèi)容存儲在一個語音文件中,同時該創(chuàng)造物的生命服務(wù)器318應(yīng)指導該創(chuàng)造物324發(fā)出存儲在該語音文件中的說話內(nèi)容?!癐f-then-endif”,“語音識別”“語音類型”“and”以及“or”都是控制字或命令或編程指令,如圖31所示。圖24B是人與計算機化創(chuàng)造物的語言交流的圖形表示,其中該交流是學生按照上面描述的參照圖24A進行編程的結(jié)果。圖24C是配備有內(nèi)置的視頻照像機342和視頻顯示器582如液晶顯示器(LCD)的創(chuàng)造物324的圖形表示,該視頻照像機為該創(chuàng)造物提供了視覺輸入并且通過該創(chuàng)造物或無線通信到計算機。該顯示器可以使該計算機為用戶提供更為詳細的信息。在圖中,該顯示用于提供更細致、更靈活的表情如眼睛、眉毛。彩色顯示器可以使計算機調(diào)整眼睛的顏色以適應(yīng)用戶或其它主題。本發(fā)明的一個特定的特征是提供有教育工具來培訓工程師或編程者來生成交流指示。一個教師可以為全班的學生確定一個整體項目,如對一個警察的行為進行編程。他可以定義一些可以分成特定事件的總的條件,而每一個事件可以分給一個學生用于編程一個交互的套件。例如,警察的行為可以分成如下模塊與受害人的親屬進行交流,與同事、老板進行交流,與要進行犯罪控訴的控訴方進行交流,與嫌疑人、同伙及目擊者進行交流。根據(jù)所涉及的犯罪是謀殺、暴力中的非謀殺、惡意犯罪、侵犯財產(chǎn)犯罪等,每一個交流以可以分成子模塊,而每一個模塊或子模塊可以分給不同的孩子。類似,一個項目又可以包括對學生的行為的編程。換句話說,該情緒化理解性的創(chuàng)造物是學生,該項目可分成例如如下的模塊面向教師的行為、面向模塊的行為以及面向其他孩子的行為。面向其他孩子的行為又可以分成如下的子模塊,如秘密俱樂部的成立、一起學習、閑談、請求幫助等。為編程一個特定的子模塊,一般要求學生至少執(zhí)行下列子模塊中的一些a.選擇觸發(fā)進入他的子模塊的初始事件。聽到單詞“俱樂部”可觸發(fā)進入“成立秘密俱樂部”子模塊,這些初始事件可以形成該模塊的狀態(tài)機的一部份或者可以優(yōu)先地被連帶的學生或教師合成一個主程序,該主程序可以根據(jù)各種事件的發(fā)生調(diào)用各種模塊。b.列出與該對話相對應(yīng)的主題以便維持在該學生與靠近該學生的某人之間。例如,為成立一個俱樂部,該俱樂部一般需要一個名稱、會員清單、密碼、標志、規(guī)則等。c.確定這些主題之間的關(guān)系。例如,一旦建立了會員清單,該密碼需要被傳送到會員清單上的所有會員。d.在該學生與該某人之間提供一個分支對話框,設(shè)計成該學生的每一個意見均會引起該某人一個響應(yīng),該響應(yīng)可以很容易地被加以分類。例如,該學生可能希望只問有限選擇的問題而不是自由回答的問題。例如,如果學生問“該標志的顏色應(yīng)是什么顏色,白色、黑色或紅色?”,那么系統(tǒng)只需要識別三個單詞中的一個。e.確定如何檢測情感及決定在學生-該人的關(guān)系中不同情感的角色。例如,結(jié)合該某人,如果該學生正在定義該成員清單,該學生可能就會注意到該某人正在變得感情豐富,該學生可因此選擇建議終止該成員清單或表現(xiàn)得感情專注。可選地或附加地,對于該某人三個或四個不同的感情狀態(tài),該學生的每一個意見可以有稍許不同的文本。其它項目包括對教師、父母、寵物、銷售商、名人等的行為的編程,應(yīng)明白,項目的范圍是無限制的。應(yīng)明白,對一個情緒上有知覺的生命的編程的復雜性會預(yù)料到產(chǎn)生娛樂條件,由此該情緒上有知覺的生命會以一種有缺陷的方式運行。于是,通過使學生錯誤與一個詼諧的結(jié)果聯(lián)系起來而緩解伴隨該學生錯誤或?qū)W生失敗條件的壓力,希望增強學習條件。對一個情緒上有知覺的生命的編程的困難并不是實施這里所顯示及描述的系統(tǒng)的困難,因為系統(tǒng)的目標是教育性和正確性,而情緒上有知覺的生命的完整功能只是一個藝術(shù)品,而不是該系統(tǒng)和目標。而且,雖然對一個情緒上有知覺的生命的編程是非常困難的,甚至過份單純化的感情敏感性(當由一臺機器規(guī)劃好時)對于人與該機器的交互產(chǎn)生很大的影響。因此,感情理解力的編程,即使在初級水平上,都是一個有所回報的活動,因而能激發(fā)學生通過實踐增強其編程的能力。圖25是一個系統(tǒng)管理器的優(yōu)選功能的簡化軟件圖,最好其中的一個教師工作站312作為一個系統(tǒng)管理器工作站使用。圖26是系統(tǒng)中教師工作站312的優(yōu)選功能簡化軟件圖,該功能用于指導開發(fā)交互式計算機化指示,如圖23A-23C中系統(tǒng)。學生管理功能(圖25中的單元715)典型地包括常規(guī)功能,如學生注冊、學生特征的統(tǒng)計分析、學生報告的生成等。集成化(單元740)可以通過多組學生或該教師來執(zhí)行,該教師工作站為該教師提供一個定義各模塊被組合的順序的集成方案。運行管理功能(單元750)用于管理多個生命服務(wù)器318。例如,一個教師在其布置階段15上可能具有由3個創(chuàng)造物生命服務(wù)器控制的創(chuàng)造物和由300個學生開發(fā)的30個項目,并且每一個包括幾個項目模塊,其中的某些項目模塊是可選的。運行管理功能使教師能夠確定在某一確定的天和時間,利用一特定的項目,一特定子集的創(chuàng)造物將被一特定的創(chuàng)造物生命服務(wù)器所控制。如果該項目包括了可選模塊,教師可以定義使用其中的哪些。圖27是系統(tǒng)中學生工作站310的優(yōu)選功能簡化軟件圖,該功能用于指導開發(fā)交互式計算機化指示,如圖23A-23C中系統(tǒng)。圖27中的分析和設(shè)計方塊815典型地包括字處理功能、畫流程圖功能和允許學生歸檔他對該項目模塊的分析的數(shù)據(jù)庫規(guī)劃設(shè)計功能。圖27中的視覺編程方塊840優(yōu)先運行以使得學生能定義和參數(shù)化軟件對象以及使這些對象與其他對象相聯(lián)系。軟件對象包括子模塊;諸如時間事件、口語事件、數(shù)據(jù)庫事件、傳感器事件以及上述事件的組合的事件;諸如動作功能、講話(回放)功能等的功能;針對狀態(tài)機的狀態(tài);以及并行運行的任務(wù)。例如,視覺編程的典型會話包括如下步驟a.學生選擇“視圖”,然后是“狀態(tài)機”,以便觀察當前定義他所在班級所分配的項目中的模塊的狀態(tài)機。作為響應(yīng),系統(tǒng)向?qū)W生顯示當前的狀態(tài)機。b.學生選擇“插入”,然后是“狀態(tài)”,由此加入一個新的狀態(tài)到該狀態(tài)機。c.學生選擇“插入”和“連接”,以便將新的狀態(tài)連接到狀態(tài)機中的已有的狀態(tài)。d.學生為所選擇的連接定義一個事件和功能,該功能可以從功能選項下列出的已有功能中選取,也可以利用程序塊選項及第三代編程語言如Basic或者通過打開該功能內(nèi)的一個狀態(tài)機來生成。選擇可以通過合適的接口機制來實施,如工具框的圖標的下拉或從一個菜單條進行選擇以及隨后從與菜單條項相關(guān)的菜單中選擇。視覺編程單元840一般允許學生選擇多個“視圖”中之一,而每一個這樣的“視圖”都包括一個由該學生如此編程的此模塊的不同的說明。該視圖例如可包括a.在賦給該學生的模塊內(nèi)的子模塊;b.在該模塊內(nèi)的事件列表。事件典型地包括時間事件,傳感器事件,語言事件,數(shù)據(jù)庫事件(如數(shù)據(jù)庫內(nèi)的一個特定的計數(shù)器達到零)以及上述事件的組合。一個事件可以從scratch中產(chǎn)生、修改或與一個源狀態(tài)和目標狀態(tài)之間的已有連接相關(guān)聯(lián);c.表明該模塊內(nèi)狀態(tài)及其間的連接的狀態(tài)機;d.任務(wù)列表,其中每一個任務(wù)包括一序列功能和/或模塊,并且在任務(wù)之間定義了一個關(guān)聯(lián)以便允許不同的任務(wù)可并行地執(zhí)行;e.在該模塊內(nèi)的功能列表,功能典型地包括語言功能,如談話、語音識別和記錄,致動器功能,如電機功能和點火功能,數(shù)據(jù)庫功能,如對存儲在該數(shù)據(jù)庫中數(shù)據(jù)進行的計算。一個功能可以從scratch中產(chǎn)生、修改或與一個源狀態(tài)和目標狀態(tài)之間的已有連接相關(guān)聯(lián)。在每一個視窗內(nèi),該學生可以修改或增加在該視窗內(nèi)所表現(xiàn)的模塊的各個方面。例如,為修改與該狀態(tài)機內(nèi)的個別連接相關(guān)聯(lián)的一個事件,該學生一般可以訪問該事件列表并修改該事件的定義,或者,學生或可以訪問該狀態(tài)機并選擇一個不同的事件以與該個別連接相關(guān)聯(lián)。圖28-31是屏幕顯示的例子,是針對視覺編程單元840的一個人機接口的部份。如圖28中菜單條所示,學生最好可以選擇執(zhí)行下列活動之一常規(guī)文件操作,常規(guī)編揖操作、視圖操作、插入操作、仿真操作以及常規(guī)的窗口及幫助操作。利用該視圖菜單,也如圖28中所示,該學生可以選擇觀察他所開發(fā)的該模塊的各種表示,例如項目圖示、模塊圖表以及任務(wù)列表等。在圖28中,該學生可以選擇在該視圖菜單內(nèi)的連接。作為響應(yīng),一般在屏幕在顯示該學生,以及在其模塊內(nèi)的已有狀態(tài)機連接的列表。該學生也可以選擇一個或另一個連接。如所示,該學生已選擇了連接t6,作為響應(yīng),學生可以看到連接t6的參數(shù)據(jù)的屏幕顯示,包括連接源和目標狀態(tài),與該連接相關(guān)的事件和功能。一般地,每個功能是一個或多個原始功能如“播放”“記錄”“設(shè)置表達式”的組合。圖29說明在響應(yīng)學生從該視圖菜單選擇狀態(tài)而產(chǎn)生的一個模塊的狀態(tài)機視圖。如所示,在狀態(tài)表中顯示了互連,其中該創(chuàng)造物從一個狀態(tài)移動到另一個狀態(tài),其中從一個狀態(tài)移動到另一個狀態(tài)是根據(jù)在狀態(tài)之間出現(xiàn)的事件的發(fā)生而有條件的,并伴隨有在狀態(tài)間出現(xiàn)的功能的發(fā)生。例如,在狀態(tài)2與狀態(tài)6間的轉(zhuǎn)移與事件7和功能7相關(guān)聯(lián)。這意味著當該創(chuàng)造物處于狀態(tài)2時,如果它檢測到事件7,它就執(zhí)行功能7并移到狀態(tài)7。例如,事件7可以是該自然人興奮,這是一個復雜的事件,是幾個原始事件如高聲、高調(diào)、在語句末的音調(diào)的增加以及由語音識別單元檢測到的“興奮”等的組合。功能7例如可以是下列消息的發(fā)送“你今天看起來非常地高興,對嗎?”。狀態(tài)6例如可以是一個對情感診斷狀態(tài)確認的等待,其中該創(chuàng)造物等待該自然人確認或拒絕該創(chuàng)造物對該自然人正處于“高興”的理解。狀態(tài)2例如可以是情感改變狀態(tài),其中已經(jīng)檢測到情感的改變,但新的情感還沒有被特征化?!癠”表示從一個狀態(tài)到另一個狀態(tài)的無條件改變。在圖30中該學生正通過插入一個新的功能來修改該模塊,該功能試圖與該狀態(tài)機內(nèi)的狀態(tài)-狀態(tài)的連接相關(guān)聯(lián),正在顯示該學生正在插入的功能是“記錄2秒”。應(yīng)明白,在觀察選項(圖28)下的功能選項可被用來定義作為一序列已有功能的功能。圖32的屏幕顯示包括一個項目的狀態(tài)機觀察的說明示例。如所示,在狀態(tài)間的每一個連接的特征在于一個事件和一個功能。事件的發(fā)生導致功能的執(zhí)行以及進程從當前狀態(tài)流到下一個狀態(tài)。例如當系統(tǒng)處于狀態(tài)1時發(fā)生事件E1,那么系統(tǒng)執(zhí)行F1并進到狀態(tài)6。在圖32中,狀態(tài)由橢圓、事件由菱形、功能由矩形表示。為了對一個連接插入一個事件和一個功能,學生可以從圖32的顯示選擇所期望的連接,然后在視覺編程的主菜單條中選擇插入,然后依次選擇功能和事件。圖33的屏幕顯示使學生能創(chuàng)建一個能測試先前生成的模塊的環(huán)境。為此,學生一般要按如下去做a.學生生成激勵該模塊的軟件仿真(開始設(shè)置);b.學生生成處理到該模塊的輸入和來自該模塊的輸出的的仿真環(huán)境。也就是,在步驟b生成的仿真環(huán)境仿真性地提供到該模塊的輸入以及,按照該模塊的仿真性輸出接收和動作,使該環(huán)境又作用回到該模塊。c.學生定義一個監(jiān)視該模塊的性能的設(shè)置。一般地,學生定義某個被檢測到的事件將被顯示到屏幕上以及某個被檢測到的事件被記錄到一個日志文件。d.學生執(zhí)行仿真,同時監(jiān)視該屏幕;以及e.學生觀察該日志文件的內(nèi)容。圖34-37是說明由圖23A、23B或23C的教師工作站312提供的屏幕顯示的例子。特別是,圖34是在圖26的學生管理單元715內(nèi)生成的屏幕顯示的例子。如所示,該屏幕顯示使教師能進入和修改學生標識的細節(jié)以及觀察賦與每個學生的項目和模塊,尤其是項目和模塊的狀態(tài)。該模塊也可以允許教師給學生分配一個標記??蛇x地,分配標記也可以是執(zhí)行監(jiān)視的一部份(單元760)。學生對項目與模塊的分配一般地在項目模塊分配單元730內(nèi)來執(zhí)行,如下面參照圖35所描述的。圖35是在圖26的項目模塊分配單元730內(nèi)生成的屏幕顯示的例子。如所示,教師一般從一個項目菜單中選擇一個項目,該項目菜單一般地顯示每一個項目的屬性如難度級別、模塊數(shù)量等。在圖13中,教師選擇了“警察”項目。如所示,在該項目內(nèi)有幾個模塊。教師也可以選擇一個班以執(zhí)行該項目。在圖35中,教師選擇了3A并且作為響應(yīng),屏幕向教師顯示班3A中學生清單。該屏幕還向教師顯示在該“警察”項目中模塊清單,然后,通過單擊在學生菜單中的所選學生,教師分配一個或多個學生給每一個模塊。圖36是在圖26的集成監(jiān)視單元740內(nèi)生成的屏幕顯示的一個例子。如所示,教師一般確定模塊被集成以形成該完整項目的至少一個序列。一般地,系統(tǒng)畫出彼此要集成的模塊間的連接的圖形表示,而每一個這樣的連接被標記以一個日期和一個狀態(tài)指示(集成/非集成)。圖37是在圖26的分配運行單元755內(nèi)生成的屏幕顯示的一個例子。該分配運行單元在所生成的創(chuàng)造物是一個自然創(chuàng)造物而不是一個虛擬創(chuàng)造物時顯得特別重要。如果是這種情況,則該自然創(chuàng)造物是一個可被多個學生共享的稀有資源。如所示,該教師典型地從一個可用的自然創(chuàng)造物池中選擇一個自然創(chuàng)造物,如紅警察,當工作在該警察項目上時,在教師定義的時間內(nèi),所選的自然創(chuàng)造物執(zhí)行由該教師的學生所定義的功能。如果兩個不同的模塊被分配到同一時間和同一創(chuàng)造物,亦即,如果指示紅色警察運行在“犯罪關(guān)系”模塊和“嫌疑”模塊,那么該教師定義一個優(yōu)先權(quán)系統(tǒng)以便這種跨越最小化。圖38是該過程的簡化流程圖示,借助于此,學生典型地使用圖23的學生工作站310。在執(zhí)行圖38的步驟910和920過程中由該學生執(zhí)行的過程的流程圖說明將參照圖41進行說明。如所示,一開始,教師或項目策劃者定義狀態(tài),即表情范疇(高興、悲傷、憤怒)。一個學生按照從人那里記錄/接收的語言輸入的內(nèi)容和/或特征,在運行中定義每一個表情范疇。該學生將到分區(qū)表情的事件定義進范疇。語言輸入的特征包括語音幅度,語音音調(diào)、說話頻率以及用詞質(zhì)量。學生顯性地定義一個問號確認各種表情范疇。學生定義每一個問號為一個狀態(tài)、每一個問號為一個功能以及每一個問號的結(jié)果為一個事件。學生和/或教師根據(jù)人的表情的范疇確定與人交流的修改。圖39是通過在學生工作站10內(nèi)的插入菜單中選擇事件所產(chǎn)生的屏幕顯示一個例子。如所示,被選擇的事件包括關(guān)閉各種開關(guān),尤其是,該事件包括關(guān)閉在該創(chuàng)造物的右手側(cè)的開關(guān)或關(guān)閉在該創(chuàng)造物的右足側(cè)的開關(guān)。圖39是通過在學生工作站10內(nèi)的插入菜單中選擇功能所產(chǎn)生的屏幕顯示一個例子。如所示,被選擇的功能包括一個眼睛移動,尤其是,該功能包括移動該眼球到左側(cè)。本發(fā)明的較佳實施例及其相關(guān)技術(shù)將參照附圖42-68加以說明。LOLA應(yīng)用的一個優(yōu)化結(jié)構(gòu)在圖42-68圖表中加以描述。LOLA系統(tǒng)是一個由幾個主進程構(gòu)成的分布式應(yīng)用。地址和數(shù)據(jù)的空間界限分離開可駐留在一個計算機或該網(wǎng)絡(luò)內(nèi)的不同計算機上的這些進程。這些進程使用標準的中間件(MW)如CORBA/DCOM/RMI以便彼此進行透明地通信。這些主進程包括任務(wù)分配器這些部件運行在與活(living)對象進行通信的每一個無線電基站,在這些部件內(nèi)的主要子部件在圖42-68中加以描述。代理對象責任系統(tǒng)中每一個活對象都有一個表示它的相應(yīng)對象。對一個活對象所做的所有操作都在其代理對象上首次激發(fā),并且由活對象生成的所有事件都在其代理對象內(nèi)首次接收。而且,該代理對象負責存儲和跟蹤每個活對象的狀態(tài)。該代理對象是一個遠程對象以便允許進程間通信。代理所使用的服務(wù)(協(xié)作)*代理正使用所提供的JavaBean以便激發(fā)操作和接收來自活對象的事件;*安全管理器以便檢驗一個請求的操作是否是合法的;*日志和事件服務(wù)以便記錄消息和生成事件;提供給其它部件的服務(wù)*由該分配器產(chǎn)生的任務(wù)與該代理們進行本地交互;*IDE可以與代理交互以便允許遠程調(diào)試或執(zhí)行;*管理控制臺可以與該代理遠程交互以便激發(fā)診斷與監(jiān)視操作;分配器引擎責任從任務(wù)管理器獲取用于執(zhí)行的已注冊的任務(wù),并以獨立的線程執(zhí)行每一個任務(wù)。該任務(wù)運行在灰箱(sandbox)內(nèi)以便加強安全策略。由該分配器使用的服務(wù)*任務(wù)管理器以便接收所注冊的任務(wù);*所產(chǎn)生的任務(wù)使用代理對象以便激發(fā)對活對象的操作;*定時器,以便接收時間事件;*日志和事件服務(wù),以便記錄消息和產(chǎn)生事件;提供給其它組件的服務(wù)*IDE可以與該分配器交互以便協(xié)作遠程調(diào)試或執(zhí)行;*管理控制臺可以與該分配器遠程交互以便激發(fā)診斷與監(jiān)視操作;定時器責任為注冊的聽眾產(chǎn)生時間事件。由該定時器使用的服務(wù)*該定時器并不使用由LOLA系統(tǒng)提供的任何服務(wù),它只使用OS服務(wù)。提供給其它組件的服務(wù)*該分配器在該定時器中注冊以便接收時間事件。LOLA服務(wù)器該組件向系統(tǒng)中所有的其它組件提供所需要的服務(wù),在此組件中的主子組件在圖42-68中加以描述。日志服務(wù)器責任該日志服務(wù)器負責記錄系統(tǒng)中其它組件的日志消息,并按照幾個標準檢索這些消息。日志消息跟事件不一樣,它只是日志,即,它僅記錄信息,而不是期望會根據(jù)此日志消息觸發(fā)某些動作。由該日志服務(wù)器使用的服務(wù)*永久存儲服務(wù),以便將日志永久保存。提供給其它組件的服務(wù)*該分配器和該代理記錄在任務(wù)執(zhí)行期間的某些任務(wù);*管理控制臺和學生IDE,以便跟蹤某些特定任務(wù)的執(zhí)行;*教師管理控制臺,以便接收關(guān)于任務(wù)執(zhí)行的統(tǒng)計。監(jiān)視引擎責任監(jiān)視器引擎負責接收來自系統(tǒng)中其它部件的事件,并且根據(jù)事件-條件-動作邏揖而動作。該監(jiān)視器引擎在系統(tǒng)范圍的基礎(chǔ)上提供這種邏揖,即便是該部件可以另外地駐留在每個無線電基站以便允許事件的本地處理。由監(jiān)視器引擎使用的服務(wù)*永久存儲服務(wù),以便永久地保存策略和所接收的事件。提供給其它部件的服務(wù)*在任務(wù)執(zhí)行期間或當測試系統(tǒng)的安全性時分配器和代理產(chǎn)生事件。*管理控制臺,以便接收事件并相應(yīng)地進行動作。安全管理器責任該安全管理器將系統(tǒng)中的所有的用戶、組及角色保存在一個庫中,并且根據(jù)它們來決定誰有權(quán)做何種事。由該安全服務(wù)器所使用的服務(wù)*永久存儲服務(wù),以便永久地保存用戶、組和角色。提供給其它部件的服務(wù)*代理,以便確認在其上所觸發(fā)遠程操作。*任務(wù)管理器,以便確認允許特定的任務(wù)注冊。任務(wù)管理器責任該任務(wù)管理器把系統(tǒng)中所有的任務(wù)保存在一個庫中,并據(jù)其向無線電基站提供所應(yīng)執(zhí)行的任務(wù)。由該任務(wù)管理器使用的服務(wù)*永久存儲服務(wù),以便永久保存這些任務(wù)。*安全管理器,以便確認任務(wù)注冊。提供給其它部件的服務(wù)*無線電基站,以便接收所注冊的任務(wù)。管理控制臺該部件是管理員的控制臺,監(jiān)視和控制系統(tǒng)的動作以及配置系統(tǒng)等,而且,該控制臺可以使教師查詢系統(tǒng)以便制作一些任務(wù),如評估學生工作,或分配給學生執(zhí)行某些特定任務(wù)的許可。在該部件中的主要子部件示于圖42-68中,在圖中也示出了這些部件的在線觀察。責任該控制臺用于聯(lián)機監(jiān)視和控制該系統(tǒng),觀察諸如在每個無線電基站上運行的任務(wù)之類的東西,以及每個活對象的狀態(tài)和情況。觸發(fā)例如改變一個特定的活創(chuàng)造物的信道的操作的能力,以及觀察系統(tǒng)中產(chǎn)生的所有事件的能力。由聯(lián)機觀察所使用的服務(wù)典型地包括*代理對象,以便觸發(fā)其上的操作及從中接收事件;*分配器,以便以一種在線方式監(jiān)視和控制任務(wù)的執(zhí)行;*監(jiān)視器引擎,以便在系統(tǒng)范圍基礎(chǔ)上接收事件。提供給其它部件的服務(wù)*在線觀察僅是一個GUI客戶。在圖中示出了配置視圖。責任在其運行時用于配置系統(tǒng)的控制臺,如定義用戶、組及角色的配置由控制臺進行。由該配置視圖所使用的服務(wù)*安全服務(wù)器,以便授權(quán)經(jīng)觸發(fā)的操作。提供給其它部件的服務(wù)*配置視圖僅是一個GUI客戶。脫機觀察責任不在系統(tǒng)正常運行期間(如升級、填加活對象等)對系統(tǒng)進行配置。由該配置視圖使用的服務(wù)提供給其它部件的服務(wù)該配置視圖僅是一個GUI客戶。教師控制臺責任該控制臺由教師使用以便評估學生的工作。教師被提供有如學生工作的普及和關(guān)于任務(wù)執(zhí)行的其它統(tǒng)計的信息。而且,教師可以觀察由學生所寫的所有任務(wù)的資源。由該配置視圖所使用的服務(wù)*任務(wù)管理器,以便觀察其學生任務(wù)的資源;*日志服務(wù)器,以便獲取關(guān)于任務(wù)執(zhí)行的統(tǒng)計信息。提供給其它部件的服務(wù)*脫機觀察僅是一個GUI客戶。集成開發(fā)環(huán)境(IDE)該部件運行在每個學生編程工作站上,其結(jié)構(gòu)支持下列三種可能性*位于學生家中的獨一無二的PC機,不連接到互連網(wǎng)。*位于學生家中的PC機,其通過互連網(wǎng)連接到LOLA系統(tǒng)。一個防火墻位于學生家中的PC機與LOLA系統(tǒng)之間。*位于企業(yè)內(nèi)部互連網(wǎng)上的PC機,其通過標準的中間設(shè)備連接到其它LOLA部件。IDE核心責任由學生所使用的集成開發(fā)環(huán)境用于編寫由任務(wù)分配器執(zhí)行的任務(wù)。由IDE核心所使用的服務(wù)*IDE核心在注冊被用于執(zhí)行之前利用活對象仿真器來測試任務(wù)。IDE核心利用代理對象以便執(zhí)行在真實活對象上的任務(wù)。該特征僅當此IDE核心可與該代理對象通過該中間設(shè)備通信之前使用,也就是,僅當PC機位于同一企業(yè)內(nèi)部網(wǎng)上、或如果防火墻不限制中間設(shè)備口的數(shù)據(jù)包時遠離家、以及可用的帶寬允許時使用。提供給其它部件的服務(wù)*IDE核心僅是一個服務(wù)客戶。代理仿真器責任仿真該活對象的代理以便允許本地調(diào)試和任務(wù)的執(zhí)行。由該配置視圖所使用的服務(wù)*提供給其它部件的服務(wù)*IDE核心將仿真器用于本地任務(wù)的執(zhí)行及調(diào)試.任務(wù)登記責任基于瀏覽器的部件為學生提供增加或刪除用于在基于無線電的PC機上執(zhí)行任務(wù)的能力.由該配置視圖使用的服務(wù)*任務(wù)注冊服務(wù)器提供給其它部件的服務(wù)*開發(fā)該部件負責開發(fā)系統(tǒng)中所有的其它部件,尤其負責開發(fā)所有的代理對象及其相應(yīng)的仿真器,并在必要時建立時這些對象。建立這些對象是有選擇的,關(guān)于此事基本上有三個可選項所有對象都是同一類型,即,所有的對象都有同一個接口,而不管它們所代表的活對象。專用于一個特定的活對象的操作通過一個公共接口如“send-cmd”執(zhí)行。這種方式的優(yōu)點在于系統(tǒng)的開發(fā)、維護及配置都簡單。其缺點是對于用戶來說一個沒什么意義的命令集,更重要的是,只有當在活對象上執(zhí)行任務(wù)時才能檢測到不正確的命令的使用,而不是在仿真器上或編譯時才檢測到。*在API級上所有對象都是同一類型,但每個對象都知道其自身的類型。在系統(tǒng)中所有的類型都駐留在一個庫中。這樣,從開發(fā)和維護觀點看,這種方式又不簡單,命令集的API仍無意義,但當任務(wù)在仿真器執(zhí)行時能檢測到錯誤。*不同的對象有不同的API來訪問它們。這樣系統(tǒng)的開發(fā)與維護就更不簡單了,因為碼是根據(jù)活對象的類型產(chǎn)生和建立的,而不是只被保存在一個庫中,或根本不保存。但是該命令集對它的用戶來說卻有意義,而且,只要任務(wù)一被編譯就能檢測到錯誤。如此一來該方式就是較佳的途徑。但是實施該方式卻需要更多的開發(fā)努力,如此一來僅能以次級迭代來實施。任務(wù)和安全管理器數(shù)據(jù)模型圖42-68包括描述任務(wù)和安全管理器數(shù)據(jù)模型的流程圖.*用戶*名稱.*密碼使用一種函數(shù)加密.*組用戶所屬的一個或多個組.*組*名稱.*用戶屬于該組的零或多個用戶.*角色與該組相關(guān)的零個或多個角色.*角色*名稱.*許可根據(jù)下列條件*活對象類型.*活對象.*計算機.*定時器類似UNIXcrontab的能力.*任務(wù)*名稱.*位置.*用戶編寫此任務(wù)的一個或多個用戶.*執(zhí)行時間何處及何時該任務(wù)將執(zhí)行,必須匹配與該用戶的組相關(guān)的角色。*活對象*名稱*類型*主人*任務(wù)操作此活對象的一個或多個任務(wù).*活對象類型*名稱.部件描述安全管理器此安全管理器為其它部件輸出兩個主服務(wù)器。部件*配置授權(quán)負責建立用戶、組、角色庫,它所輸出操作是遠程操作,當管理員決定更新學生、組及角色的定義時就觸發(fā)這些操作。該管理員使這些變化通過其基于GUI的控制臺,該控制臺利用上述的操作起到一個客戶作用。*配置授權(quán)利用庫中的數(shù)據(jù),檢查是否一個特定的操作是合法的。這種服務(wù)的客戶是*任務(wù)管理器-無論何時當學生注冊一個任務(wù)時,它就請求確認。*代理對象-無論何時當學生觸發(fā)一個操作時,它就請求確認。任務(wù)管理器該任務(wù)管理器將系統(tǒng)中所有任務(wù)保存在一個庫中,并據(jù)此向相應(yīng)的無線電基站提供它們應(yīng)該執(zhí)行的任務(wù)。圖42-68圖示說明該情節(jié),其中一個學生注冊一個要執(zhí)行的任務(wù)。她首先輸入其用戶及密碼,然后安全管理器驗證該學生。如果是許可的,則該學生獲得所有允許的操作清單,即,獲得具有下列操作的清單*增加任務(wù)*刪除任務(wù)*更新任務(wù)*列出所有已注冊的任務(wù)假定該學生決定注冊一個任務(wù)用于執(zhí)行,因此她選擇“增加任務(wù)”操作。該任務(wù)管理器接收任務(wù)內(nèi)容及任務(wù)信息,并且查詢安全管理器該學生是否被允許注冊一個具有特定任務(wù)信息的任務(wù)。如果是,任務(wù)管理器就注冊該任務(wù),然后通知該學生注冊成功結(jié)束。任務(wù)規(guī)劃器任務(wù)規(guī)劃器負責規(guī)劃所有已注冊的任務(wù),無論何時當一個任務(wù)的執(zhí)行時間到達時,規(guī)劃器就通知分配器應(yīng)該下載該任務(wù)并產(chǎn)生(spawn)它。當規(guī)劃器起動時,它重復通過所有的已注冊任務(wù)的列表,并針對每一個SchedInfo對象建立一個包含本任務(wù)應(yīng)起動和停止的下次時間的簡單對象。該任務(wù)規(guī)劃器根據(jù)所有已注冊任務(wù)的執(zhí)行時間保存它們的索引表,然后,無論何時任務(wù)的執(zhí)行時間來到時,它在定時器中注冊以接收事件。在接收到該事件后,它就通知相應(yīng)的分配器應(yīng)下載并執(zhí)行該任務(wù)。任務(wù)分配器無論何時,當任務(wù)的起動時間來到時,任務(wù)分配器從該規(guī)劃器獲得一個已注冊的任務(wù),然后以獨立的線程執(zhí)行該任務(wù)。每個任務(wù)運行在灰箱內(nèi)以便強化安全策略。下列狀態(tài)圖描述了該任務(wù)分配器。在圖42-68中的一個圖描述了系統(tǒng)中該任務(wù)分配器、任務(wù)規(guī)劃器及其它組件中的數(shù)據(jù)流。任務(wù)規(guī)劃器可從定時器中接收時間事件以及來自任務(wù)管理器中的taskListChange事件。該時間事件在任務(wù)的起動執(zhí)行時間到達時產(chǎn)生。該事件觸發(fā)了任務(wù)從規(guī)劃器到分配器的下載和產(chǎn)生(spawn)。TaskListChange事件實際上改變了規(guī)劃任務(wù)的清單,由此改變了定時器中的注冊。管理控制臺可以手動地瀏覽和改變正在執(zhí)行的任務(wù)。下面描述關(guān)于首選的LOLA系統(tǒng)的總體考慮。LOLA(活對象實驗室)是一個計算機班級,可使學生建立和體驗稱為活對象的自然人物(figure)的生動化。該生動化為活對象提供了以人聲、似人和智能方式與人交互的能力?;顚ο髮嶒炇医探o學生分析、設(shè)計和將“自然智能(NI)”編程進自然對象-活對象形象。由學生開發(fā)的NI隨著時間增加和積累活對象與學生交互的能力?;顚ο笮蜗蠓植嫉讲賵?,并用作為對所有孩子們的娛樂和教育目的。自然智能自然智能是計算機化對象提供“類似人的行為”的能力,人尤其是年輕人非常能接受一直在變化的環(huán)境,這種技巧允許在與人的交互中有更大的自由。基于計算機的系統(tǒng)具有嚴格的交互協(xié)議,只要交流者(用戶或另一個計算機化的機器)嚴格地遵循協(xié)議的規(guī)則,一個計算機化的機器的行為是高度可預(yù)測的并且非常精確。與該協(xié)議的偏離將導致交互的立即中止。計算機編程和基于計算機的機器被用于“解決問題”,當達到一個識別得很好的目標時該程序結(jié)束(暫停、或等待一個新的輸入或事件),人的交互被定向于建立一個逐漸增加的共享理解。即使當最后的交互目標是解決一個問題時,每一步交互的“連續(xù)目標”是搜集和增加相應(yīng)的信息至知識的集中池,這可在最后的目標到達之前來進行。在很多環(huán)境下,在交互開始之前是不知道最后的目標的,僅作為交互的結(jié)果而在以后標識出。將自然智能裝進機器使得該機器可執(zhí)行下列循環(huán)1、標識一種環(huán)境;2、對人作出應(yīng)答;3、傳送描述對該環(huán)境的累積或附加理解的信息;4、標識什么信息正在丟失;5、建議附加信息;6、請求附加信息;7、接收人的響應(yīng)并分析它。LOLA的目標LOLA的首次實施是針對教育目的的高校,這些是該項目的高級目標*教授學生分析、設(shè)計以及將“自然智能(NI)”編程進自然對象。*友好并容易地使用該系統(tǒng),來吸引學生學習高技術(shù)課程。*支持教師進行任務(wù)分配和評分。*作為基于內(nèi)容的對象,取悅并提供信息給學生及教職員工。服務(wù)和他們使用情形的分析系統(tǒng)中的主要參與者是學生、教師、管理員和用戶。該文檔聲明了系統(tǒng)的參與者的重要的使用情形,該使用情形被參與者以及服務(wù)編組學生、教師、管理員和用戶。一個人可以作為一個或多個參與者而存在,尤其是,每個學生、教師和管理員同時又是用戶,有可能同一個人可能既是教師又是管理員。系統(tǒng)中的主要部件是*編程基站每個基站包含IDE(集成開發(fā)環(huán)境),提供將NI編程進活對象的能力。在學生家中的計算機在安裝了生成器IDE后也可以是這樣的一種編程基站。*無線電基站每個基站與一個或多個活對象(通過RF通信)進行通信,并發(fā)送這些對象命令。*LOLA服務(wù)器主管LOLA系統(tǒng)中服務(wù)器(如任務(wù)服務(wù)器、安全服務(wù)器)的基站。*教師和管理員控制臺在實驗室中的基站,由教師和管理員分別使用。*活對象活對象是配備有控制裝置的玩具。該控制裝置包括微控制器、無線電發(fā)送接收器和I/O口,I/O口連接到同樣包含在該活對象內(nèi)的外設(shè),如揚聲器、麥克風、傳感器、致動器、電機、燈、視頻照相機等。這些外設(shè)可使該活對象能以人的方式與人打交道,外設(shè)由該微控制器操作運行,該控制器通過內(nèi)置的發(fā)射接收器從基于無線電的PC實時地接收程序指令。隨后介紹提供用于建立內(nèi)部數(shù)據(jù)庫的數(shù)據(jù)的另外兩個次級參與者。提供用于建立內(nèi)部數(shù)據(jù)庫的數(shù)據(jù)的信息服務(wù)器支持來自學生任務(wù)的查詢,一個內(nèi)容提供商提供將被保存在內(nèi)容服務(wù)器中的內(nèi)容,這些內(nèi)容將被規(guī)劃成按所要求的執(zhí)行。我們描述服務(wù)以及相關(guān)使用情形的分析。學生服務(wù)提供給學生(組建該活對象的行為的人)的主要服務(wù)在附圖中加以說明。名稱生成器IDE安裝參與者如果安裝在家里的PC機上則是學生,如果是安裝在學校的PC上則是管理員。教師也可以將IDE安裝在家中的PC上以便瀏覽其學生的任務(wù)。目標生成器IDE要被正確地安裝。前后的影響1)可能先前已有安裝,這時將對已有的安裝進行升級。2)安裝保護型安裝3)學生一般使用Windows95/98,但也可能使用其它的環(huán)境如Macintosh、windows3.1/DOS、UNIX或NC(這時的安裝將發(fā)生在服務(wù)器上)。觸發(fā)器參與者從CD或一個下載文件起動安裝。總結(jié)這種使用情形采用了第一個或稍后的生成器IDE安裝1)要求參與者提供幾個配置參數(shù)。2)參與者進到生成器IDE的正常使用。先決條件參與者下載該文件包或有一個CD。后條件生成器IDE已安裝。相關(guān)使用情形應(yīng)該隨后立即生成或更新家中PC上的活對象,在用戶方便時推遲到以后進行。名稱增加家中活對象類型參與者學生如果教師在家中的PC上已安裝了IDE,則教師也可能是這種情形的參與者。在此,管理員不是參與者管理員有單獨的使用情形-處理活對象的更新。目標對于生成器IDE來說,系統(tǒng)中所有的活對象的類型都是已知的,以便為每種活對象類型支持一個仿真器。前后的影響1)信息源一般是安裝在學校的LOLA系統(tǒng),更新過程將是基于瀏覽器并通過因特網(wǎng)來完成,一個防火墻設(shè)置在家中的學生瀏覽器和LOLA系統(tǒng)之間。2)在學校,學生可以把所需要的數(shù)據(jù)放置在一張軟盤上,然后將其安裝在家中的PC上。觸發(fā)器可以是下列觸發(fā)器之一1)生成器IDE剛剛被安裝。2)新型活對象已被連接到系統(tǒng)??偨Y(jié)生成或更新對于安裝在學生的家中的IDE是已知的活對象類型。先決條件生成器IDE被安裝。后條件1)在生成器IDE中的仿真器匹配可用的活對象的類型。2)學生可以著手建立一個決策樹。相關(guān)使用情形1)生成器IDE安裝2)LOLA安裝名稱建立一個決策樹參與者學生目標建立一個準備復雜化的任務(wù)。前后的影響1)不需要編程知識2)容易使用且友好的GUI3)可再次應(yīng)用以前任務(wù)中所做的決策樹或子樹。4)可使用內(nèi)建的決策樹或子樹。5)學生想使用對其正在使用的玩具來說是高級的命令。觸發(fā)器1)教師給學生分配作業(yè)。2)學生在實驗室的上課期間或通過自由選擇建立決策樹??偨Y(jié)該使用情形捕獲這樣一種情況學生建立一個決策樹以便將NT編程進一個活對象1)學生起動生成器IDE;2)學生建立一個決策樹;先決條件1)準備復雜化的任務(wù)。相關(guān)的使用情形1)生成器IDE安裝是所要求的;2)在家中的PC上生成或更新活對象類型是所要求的。名稱建立一個高度定制的決策樹。參與者學生目標建立一個準備復雜化的任務(wù)。前后的影響1)要求基本的編程技巧;2)易于使用編程語言和庫;3)再次應(yīng)用在先前任務(wù)中所做的決策樹或子樹;4)使用內(nèi)建決策樹或子樹;5)學生想使用對其正在使用的玩具來說是高級的命令。觸發(fā)器1)教師給學生分配作業(yè)。2)學生在實驗室的上課期間或通過自由選擇建立決策樹??偨Y(jié)該使用情形捕獲這樣一種情況學生建立一個決策樹以便將NT編程進一個活對象1)學生起動生成器IDE;2)學生建立一個決策樹;先決條件1)生成器IDE安裝在學生桌面上;2)仿真器仿真存在于學校內(nèi)的活對象。后條件1)準備復雜化的任務(wù)。相關(guān)使用情形1)生成器IDE安裝是所要求的;2)在家中的PC上生成或更新活對象類型是所要求的。名稱編譯一個任務(wù)參與者學生目標產(chǎn)生一個準備在活對象上執(zhí)行的任務(wù),并根據(jù)由該學生建立的決策樹而動作。前后的影響1)學生不必對該決策樹的內(nèi)部實現(xiàn)熟悉;2)如果該學生只建立了一個決策樹,而沒有增加學生定義的宏/碼,則希望該復雜化過程能通過大多數(shù)情況。3)通過觀察決策樹應(yīng)能顯示復雜化的錯誤/警告。只有在學生增加宏的情況下,這些行也被顯示。4)友好、易于使用。觸發(fā)器1)學生已建了一個決策樹??偨Y(jié)該使用情形捕獲這樣一種情況學生建立了一個決策樹并想編譯它。1)學生起動生成器IDE2)學生建立了一個決策樹;3)學生編譯該任務(wù)。先決條件1)學生已建了一個決策樹。后條件1)如果復雜化通過-一個任務(wù)準備執(zhí)行。相關(guān)的使用情形1)建立一個高度定制化的決策樹或建立一個決策樹是所要求的。名稱執(zhí)行一個任務(wù)參與者學生目標學生PC上本地執(zhí)行一個任務(wù)以便檢查它,該對象與一個駐留在學生PC機上的活對象仿真器進行交互,或者如果可能的話,與一個連接到學生PC或網(wǎng)絡(luò)中其它PC上的自然對象進行交互。前后的影響1)活對象仿真器應(yīng)精確地仿真一個自然對象的行為,尤其是,它應(yīng)當指出當此任務(wù)單獨地在一個活對象上執(zhí)行時可能發(fā)生的所有任務(wù);2)作為一個生成器IDE的集成部件看待;3)友好、易于使用;4)安全在學生試圖執(zhí)行連接到一個遠程PC的活對象上的任務(wù)時檢驗該學生的許可權(quán)利。觸發(fā)器1)學生建立和編譯一個任務(wù)并希望執(zhí)行它??偨Y(jié)該使用情形捕獲這樣一種情況學生建立了一個決策樹并想立即運行它,一般地以便檢查該任務(wù)。1)學生起動生成器IDE;2)學生建立一個決策樹;3)學生編譯該任務(wù);4)學生執(zhí)行該任務(wù)。先決條件1)一個任務(wù)準備在一個活對象上執(zhí)行。相關(guān)使用情形1)建立一個高度定制化決策樹或建立一個決策樹或編譯一個任務(wù)是所要求的。名稱調(diào)試一個任務(wù)參與者學生目標在學生PC上本地調(diào)試一個任務(wù),該任務(wù)與駐留在學生PC上的活對象仿真器進行交互,或者可能的話,與一個連接到該學生PC或網(wǎng)絡(luò)中其它計算機上的自然對象進行交互。前后的影響1)活對象仿真器應(yīng)精確地仿真一個自然對象的行為,尤其是,當此任務(wù)與該活對象單獨地執(zhí)行時它應(yīng)能指出發(fā)生的所有錯誤;2)作為生成器IDE的集成部件看待;3)友好且易于使用;4)如果學生在一個連接到如遠程PC的活對象上執(zhí)行該任務(wù)則進行安全檢查。5)學生可以按步驟地跟蹤任務(wù)的執(zhí)行,并可以圖形方式觀察決策樹中哪一個點正在被執(zhí)行。6)學生可以進入代碼行調(diào)試,以增加決策樹;7)一般的調(diào)試能力如步入、步出、進到光標處、設(shè)置斷點、繼續(xù)、觀察設(shè)置點等。觸發(fā)器學生建立并編譯一個任務(wù),并希望調(diào)試它??偨Y(jié)該使用情形捕獲這樣一種情況學生建立了一個決策樹并想調(diào)試它。1)學生起動生成器IDE;2)學生建立一個決策樹;3)學生編譯該任務(wù);4)學生調(diào)試該任務(wù)。先決條件1)學生建立了一個決策樹。后條件1)一個任務(wù)準備好在一活對象上執(zhí)行。相關(guān)使用情形1)學生建立了一個高度定制化的決策樹或建立了一個決策樹并編譯該任務(wù)是所要求的。名稱任務(wù)注冊參與者學生目標該任務(wù)被正確地安裝,并當規(guī)劃時運行。前后的影響1)通過因特網(wǎng)或企業(yè)內(nèi)部網(wǎng)的基于瀏覽器的注冊;2)安全、保密;3)防火墻駐留在基于網(wǎng)站的客戶和該服務(wù)器之間。觸發(fā)器學生起動注冊過程,一般地是在她已建立、執(zhí)行和調(diào)試一個任務(wù)之后??偨Y(jié)該使用情形可以保證學生注冊了一個用于執(zhí)行的任務(wù)。1)請求學生的用戶名和口令;2)請求學生發(fā)送任務(wù)文件;3)學生可以瀏覽所有他已注冊的任務(wù),并執(zhí)行其它的操作如刪除先前注冊的任務(wù)。先決條件學生已建立、執(zhí)行和調(diào)試了她的任務(wù)。后條件任務(wù)被注冊成按規(guī)劃的執(zhí)行。相關(guān)使用情形1)調(diào)試或執(zhí)行一個任務(wù)。名稱瀏覽任務(wù)的執(zhí)行日志參與者主要參與者是學生,教師和管理員也可以是這種情形下的參與者,一般是幫助解決問題的。目標瀏覽已執(zhí)行的任務(wù)的日志,一般是為了診斷問題。前后的影響1)學生可以從連接到該企業(yè)網(wǎng)的每個PC上瀏覽該日志;2)通過因特網(wǎng)的基于瀏覽器的日志瀏覽,其中,防火墻駐留在家中PC和LOLA系統(tǒng)之間是較好的特點;3)學生可以根據(jù)幾種條件瀏覽日志。觸發(fā)器1)學生的任務(wù)已執(zhí)行,學生想瀏覽該執(zhí)行的日志??偨Y(jié)這種使用情形捕獲了這樣一種情形學生已建立了一個決策樹,并將其登記用于執(zhí)行,并想瀏覽該執(zhí)行的日志。1)學生起動生成器IDE;2)學生建立一個決策樹;3)學生調(diào)試該任務(wù);4)學生注冊該任務(wù);5)學生瀏覽該執(zhí)行的日志。先決條件1)學生已注冊了一個任務(wù),且該任務(wù)已被執(zhí)行。后條件1)學生理解她的任務(wù)是如何被執(zhí)行的。相關(guān)使用情形1)注冊任務(wù)是所要求的。教師服務(wù)教師負責任務(wù)分配、檢查及評估的各個方面。名稱瀏覽學生任務(wù)參與者教師目標瀏覽學生的任務(wù)以及對其任務(wù)進行評估或幫助解決問題。前后的影響1)安全、策略-只有教師可以瀏覽學生的任務(wù);2)教師可瀏覽每一個注冊的任務(wù);3)教師使用生成器IDE作為任務(wù)瀏覽器;4)根據(jù)配置,教師可以或不可以改變學生的任務(wù)。觸發(fā)器教師想評估她的學生的任務(wù)或幫助她們解決問題??偨Y(jié)1)教師起動生成器IDE;2)教師登錄進入任務(wù)管理器;3)教師從該服務(wù)器裝載一個任務(wù)到她的IDE。先決條件1)生成器IDE安裝在該教師的桌面上。后條件1)學生任務(wù)出現(xiàn)在教師的控制臺上。相關(guān)使用情形生成器IDE的安裝是所要求的所執(zhí)行任務(wù)統(tǒng)計的使用情形也可用作為一個措施以評估學生。名稱所執(zhí)行任務(wù)的統(tǒng)計參與者教師目標教師瀏覽關(guān)于學生任務(wù)的統(tǒng)計,以便評估他們的工作。前后的影響1)安全、保密-只有教師可以瀏覽學生的任務(wù);2)教師可以瀏覽有關(guān)其學生的每一個任務(wù)的統(tǒng)計。觸發(fā)器1)教師想評估她的學生的工作??偨Y(jié)1)教師登錄進入統(tǒng)計服務(wù)器;2)教師從該服務(wù)器查詢數(shù)據(jù),并瀏覽該數(shù)據(jù)。先決條件學生任務(wù)已在系統(tǒng)中執(zhí)行。后條件教師有更多的措施來評估其學生。相關(guān)使用情形瀏覽學生任務(wù)的使用情形也可以作為評估學生任務(wù)的措施。管理員服務(wù)管理員負責系統(tǒng)的安裝、開發(fā)、維護、診斷、監(jiān)視及控制。名稱安裝參與者管理員目標該LOLA系統(tǒng)將被正確地安裝。前后的影響1)應(yīng)用組件應(yīng)該以這樣一種方式開發(fā)不會產(chǎn)生瓶頸,系統(tǒng)將以有效的方式運行;2)安裝過程可以從中央位置來完成;3)先前可能已有安裝,在這各情況下,安裝將是更新先前的版本;4)類似安裝的安裝保護;5)系統(tǒng)應(yīng)被調(diào)整成支持十個活對象和成百個學生。觸發(fā)器管理員從CD或一個下載的文件上起動安裝過程??偨Y(jié)這種使用情形捕獲了系統(tǒng)的第一和稍后的安裝1)詢問管理員幾個配置參數(shù);2)管理員進而更新活對象的使用情形。先決條件管理員下載文件包或有一個CD。后條件設(shè)置用于定義活對象類型的所有東西。相關(guān)使用情形1)更新活對象類型立即隨后進行,也可以延遲到用戶方便的稍后時間。名稱增加活對象類型參與者管理員目標系統(tǒng)中所有活對象的類型和對象對于該系統(tǒng)來說都是已知的,并據(jù)其來開發(fā)相應(yīng)的應(yīng)用組件。前后的影響1)從一個中央位置來進行;2)活對象和對象類型在其生命周期內(nèi)可以從系統(tǒng)中增加或刪除,而不只是在安裝后。3)尤其是,駐留在學生家中的PC上的IDE內(nèi)的仿真器應(yīng)被更新。觸發(fā)器1)LOLA系統(tǒng)已經(jīng)被安裝了;2)活對象的新類型已被連接到該系統(tǒng)??偨Y(jié)根據(jù)可用的活對象來配置系統(tǒng)。先決條件系統(tǒng)的安裝后條件在系統(tǒng)中所有活對象的類型是已知的。相關(guān)的使用情形1)安裝2)觸發(fā)在家中PC上生成或更新活對象類型的使用情形。名稱學生、組和角色定義參與者管理員目標學生可登錄進該系統(tǒng),并根據(jù)他們的權(quán)力許可執(zhí)行某些動作。前后的影響1)靈活性-學生可以屬于一個或多個組,并且每一個組可以有一個或多個角色,同一角色可被分配到幾個組;2)該過程可以在安裝或活對象的配置后進行,以及在無論何時新的學生、組或角色應(yīng)當被增加或刪除的有規(guī)律的基礎(chǔ)上;3)用戶的定義獨立于系統(tǒng)用戶。觸發(fā)器教師請求管理員打開到他的學生的帳戶,以便他們開始應(yīng)用該系統(tǒng)??偨Y(jié)該使用情形捕獲這樣一種情景一個班的教師希望她的學生被授權(quán)使用該系統(tǒng)。1)管理員定義角色每個角色定義包括角色名稱和角色的所有者被賦與的許可權(quán),許可權(quán)可根據(jù)下列條件來授予*活對象類型;*活對象;*次數(shù)類似UNIXcrontab的能力;2)管理員定義組每組的定義包括組名、與該組相關(guān)的零個或多個角色;3)管理員定義用戶每個用戶定義包括用戶名、密碼(用一種函數(shù)加密)以及零或多個與該組相關(guān)的角色。先決條件1)安裝;2)更新活對象類型。后條件學生可以根據(jù)他們的許可權(quán)登錄進該系統(tǒng)。相關(guān)使用情形1)安裝和更新活對象類型是所要求的。名稱診斷、監(jiān)視和控制系統(tǒng)。參與者管理員目標該參與者能診斷、監(jiān)視和控制系統(tǒng)。前后的影響1)在可能時能檢測到潛在的問題;2)通過診斷工具分離該問題;3)通過正確的措施解決該問題;4)自動進行全面檢查;5)允許管理員定義針對某些事件的自動動作,例如,根據(jù)所接收到的特定的時間事件改變此RF信道;6)管理員可以觸發(fā)對活對象的操作,并以一種聯(lián)機的方式從該處接收事件;7)管理員可以瀏覽系統(tǒng)中的所有事件;8)基于瀏覽器的管理控制臺;9)安全;10)與企業(yè)管理控制臺(如果有的話)集成。觸發(fā)器在有規(guī)律的基礎(chǔ)上,或在學生或教師提出問題后,對系統(tǒng)的管理。總結(jié)1)管理中起動基于瀏覽器的管理站;2)管理員診斷、監(jiān)視和控制系統(tǒng)。先決條件1)系統(tǒng)已被安裝。后條件系統(tǒng)運行正常。相關(guān)使用情形1)安裝;2)瀏覽和改變?nèi)蝿?wù)的規(guī)劃時間。名稱瀏覽和改變?nèi)蝿?wù)的規(guī)劃時間。參與者管理員目標從一個中央位置或通過對整個系統(tǒng)的觀察控制任務(wù)的執(zhí)行時間。前后的影響1)從任務(wù)規(guī)劃中滋生的潛在問題應(yīng)當在可能時事先檢測到;2)管理員應(yīng)能看到系統(tǒng)中所有任務(wù)的規(guī)劃時間;3)管理員應(yīng)能改變?nèi)蝿?wù)的規(guī)劃時間或能規(guī)劃用于執(zhí)行的未規(guī)劃任務(wù);4)安全性。觸發(fā)器1)學生剛剛注冊了用于執(zhí)行的任務(wù),管理員希望驗證學生們恰當?shù)匾?guī)劃了他們的任務(wù)。注意學生僅能根據(jù)他們的許可權(quán)力注冊任務(wù)。但是他們?nèi)钥赡懿磺‘數(shù)刈粤巳蝿?wù)-如-如果兩個或多個在同一活對象上注冊了任務(wù),且次數(shù)重迭,那么這些任務(wù)將作用在同一傳感器上;2)學生們已經(jīng)注冊了任務(wù),但沒有聲明規(guī)劃時間,一般地,因為管理員想避免沖突而自己聲明它,這樣,管理員聲明了所有任務(wù)的規(guī)劃時間;3)任務(wù)已經(jīng)從一個因特網(wǎng)上的內(nèi)容提供商服務(wù)器處下載,管理員想規(guī)劃這些任務(wù)用于執(zhí)行??偨Y(jié)1)管理員起動基于瀏覽器的管理站;2)管理員瀏覽系統(tǒng)中的所有任務(wù)和它們的規(guī)劃時間(如果已規(guī)劃的話);3)管理員改變?nèi)蝿?wù)的規(guī)劃時間或規(guī)劃用于執(zhí)行的新的任務(wù)。先決條件1)系統(tǒng)已安裝;2)任務(wù)已注冊在系統(tǒng)中或被下載進系統(tǒng)。后條件任務(wù)被規(guī)劃成按所要求的執(zhí)行。相關(guān)使用情形1)安裝;2)診斷、監(jiān)視和控制系統(tǒng)。用戶服務(wù)該用戶可以是操場內(nèi)與該活對象進行交互的任何人,尤其是,可以是一個學生、教師、管理員或一個都不是。名稱與活對象進行交互參與者用戶目標交互的目的可以娛樂、教育、任務(wù)檢測(學生或教師)、系統(tǒng)檢測(管理員)。前后的影響1)友好地交互;2)活對象按照所注冊的任務(wù)而運行規(guī)劃這些用于執(zhí)行的任務(wù)的規(guī)劃器。3)用戶看見操場內(nèi)的活對象并決定與之交互。總結(jié)該使用情形捕獲這樣一種情形一個用戶與一個活對象進行交互,用戶通過語音(聽或與之交談)、觀察其反應(yīng)或觸發(fā)其傳感器而與該活對象交互。先決條件一個或多個任務(wù)與該活對象一起執(zhí)行。后條件一個或下列中的兩個1)娛樂該用戶,更多地是教育;2)利用一個自然對象(學生或教師)檢查該任務(wù);3)已檢查了活對象的功能性(管理員);相關(guān)使用情形1)執(zhí)行一個任務(wù);2)調(diào)試一個任務(wù);3)任務(wù)注冊。內(nèi)容提供商服務(wù)與該系統(tǒng)交互的外部服務(wù)器,以便將數(shù)據(jù)推進(push)LOLA數(shù)據(jù)庫,或根據(jù)來自一個LOLA客戶的要求提供這樣的數(shù)據(jù)。名稱建立內(nèi)容數(shù)據(jù)庫參與者內(nèi)容提供商目標拖出(pull)或提供將在活對象上運行的任務(wù)(內(nèi)容)。前后的影響1)支持為LOIS系統(tǒng)所開發(fā)的能力;2)內(nèi)容可以在有規(guī)律的基礎(chǔ)上自動地被推進,或根據(jù)請求被拖出來;3)由該內(nèi)容提供商所寫的任務(wù)以與學生所寫的任務(wù)相似的方式被規(guī)劃執(zhí)行;觸發(fā)器取決于下列配置1)一般地,管理員將配置推進客戶以便在特定的時間間隔上運行更新,因此觸發(fā)器是推進客戶觸發(fā)器;2)管理員可以手動初始化一個下載??偨Y(jié)該使用情形捕獲這樣一種情景學校的管理員想要規(guī)劃由內(nèi)容服務(wù)商提供的要執(zhí)行的任務(wù),并在有規(guī)律的基礎(chǔ)上更新這些任務(wù),這些任務(wù)是以一種與學生所寫的任務(wù)相似的方式進行規(guī)劃執(zhí)行。所有的使用情形支持動作,如注冊、付帳,內(nèi)容提供商被認為是LOLA系統(tǒng)的一部份。先決條件1)已安裝了LOLA系統(tǒng);2)安裝和注冊使用LOIS系統(tǒng)的情形。后條件1)準備用于執(zhí)行的新任務(wù)駐留在任務(wù)數(shù)據(jù)庫中。相關(guān)使用情形1)安裝信息服務(wù)器服務(wù)外部服務(wù)器與該系統(tǒng)交互以便將數(shù)據(jù)推進LOLA數(shù)據(jù)庫,或者根據(jù)LOLA客戶的請求提供這樣的數(shù)據(jù)。名稱提供信息以建立支持學生任務(wù)查詢的數(shù)據(jù)庫。參與者信息服務(wù)器目標推進或提供用于學生數(shù)據(jù)庫查詢的數(shù)據(jù)。前后的影響1)使用標準工具或協(xié)議以建立這樣的數(shù)據(jù)庫;2)數(shù)據(jù)可以在有規(guī)律的基礎(chǔ)上自動推進,或有請求時被拖出來。觸發(fā)器取決于下列配置1)一般地,管理員將配置該推進客戶以便在特定的間隔上運行更新,因此觸發(fā)器是推進客戶規(guī)劃器;2)管理員可以手動地初始化一個下載??偨Y(jié)該使用情形捕獲這樣一種情景學校的管理員想建立一個學生可查詢的內(nèi)部數(shù)據(jù)庫,而不是在網(wǎng)頁上搜索想要的數(shù)據(jù)。先決條件已安裝了LOLA系統(tǒng)。后條件1)數(shù)據(jù)庫被更新。相關(guān)使用情形1)安裝圖42是一種情感相互作用流程圖設(shè)計過程的簡化流程圖說明。圖43-102說明根據(jù)本發(fā)明一個優(yōu)選實施例構(gòu)筑和工作的一種計算機化編程教學系統(tǒng)的一些優(yōu)選實施例?,F(xiàn)在詳細說明圖69-102。圖69是該系統(tǒng)網(wǎng)絡(luò)的一般邏輯全貌圖,其中,各個服務(wù)器(例如數(shù)據(jù)庫服務(wù)器316和創(chuàng)造物控制服務(wù)器318)位于中央,而學生編程工作站310、教師站312、管理員站1200和無線電基地站320則聚集在各服務(wù)器的周圍。圖70是對創(chuàng)造物322的控制的一般邏輯全貌圖,其中,無線電基地站(它向各種創(chuàng)造物提供控制)位于中央,而學生編程工作站310、教師站312、管理員站1200、和無線電基地站320則聚集在各服務(wù)器的周圍。圖71是管理員站的主菜單,其中包括4個主要的子菜單關(guān)于系統(tǒng)操作的“實時信息”1250,用于尋找硬件和軟件的問題的“診斷”1260、軟件和硬件的“配置和記錄”1270,以及用來調(diào)度和管理由學生提出并由系統(tǒng)執(zhí)行的各種任務(wù)(項目、程序)的“任務(wù)”1200。圖72說明在家里建立和測試一個任務(wù)(項目、程序)的一些基本步驟。首先,學生建立任務(wù)(步驟1290),然后編譯源碼(步驟1300),然后利用仿真器執(zhí)行任務(wù)(步驟1310),如果任務(wù)未能按其設(shè)計要求執(zhí)行,則學生將利用仿真器為程序找錯,找出問題,進行改正,然后重新測試任務(wù)(步驟1320)。如果任務(wù)能按設(shè)計要求執(zhí)行,則學生將記錄該任務(wù)(步驟1330),準備對一個物理創(chuàng)造物執(zhí)行。圖73說明學生在家里和學校里建立,測試和記錄一項任務(wù)的處理過程。該過程以家里的學生開始,與圖62類似,不過這里學生將把任務(wù)轉(zhuǎn)移到學校,并在學校里繼續(xù)同樣的過程。圖74是說明一個非常簡單的“決策樹”(也稱為“狀態(tài)引擎”)的流程圖,該流程圖教導創(chuàng)造物進入“聆聽橫式”于是記錄用戶發(fā)出的語聲并利用語言識別引擎處理這個記錄。聆聽模式一直持續(xù)到識別出詞語“清醒”,點明任務(wù)是唱出一首歌曲。當完成歌曲之后,處理過程將重復進行。圖75是說明仿真引擎主要功能的方框圖。仿真引擎使學生能在不存在物理創(chuàng)造物的情況下測試所建立程序(任務(wù))對物理創(chuàng)造物的有效性。仿真引擎利用一些標準計算機周邊設(shè)備來提供物理創(chuàng)造物的所有物理功能例如用計算機話筒模擬創(chuàng)造物的聆聽功能1450,用計算機揚聲器模擬創(chuàng)造物的說話功能1460,用在計算機屏幕上顯示創(chuàng)造物的動作來模擬創(chuàng)造物的運動1470,用計算機鍵盤和鼠標來模擬創(chuàng)造物的傳感器1480,以及用計算機顯示器和周設(shè)攝像機來模擬安裝在創(chuàng)造物中的視頻顯示器和攝像機。圖76是說明對一個項目(任務(wù))的記錄和執(zhí)行的處理的流程圖。在步驟1500中,學生或教師把任務(wù)記錄在數(shù)據(jù)庫服務(wù)器(LOLA服務(wù)器)316中,供以后借助于一個特定創(chuàng)造物控制服務(wù)器318和一個特定創(chuàng)造物324來執(zhí)行,在步驟1510中,根據(jù)在記錄步驟1500中所規(guī)定的日期、時間或其他條件,LOLA服務(wù)器316把任務(wù)傳送給相應(yīng)的創(chuàng)造物控制服務(wù)器318執(zhí)行。創(chuàng)造物控制服務(wù)器通過利用無線電基地站320把命令發(fā)送給相應(yīng)的創(chuàng)造物324來發(fā)出程序和執(zhí)行程序。圖77是教師們能得到的一些主要服務(wù)的方框圖。教師可以訪問IDE的唯一擴展形式(步驟1600),以選擇和檢查每個學生的每項任務(wù)(步驟1610)。教師能夠瀏覽學生的任務(wù)(1620),觀看關(guān)于任務(wù)的執(zhí)行的統(tǒng)計情況(1630),例如絕對性能統(tǒng)計(1640)和相對性能統(tǒng)計(1650),以及給學生打分(1660)。圖78是活對象實驗室(LOLA)系統(tǒng)拓撲結(jié)構(gòu)的方框圖,其中包括以下一些主要子系統(tǒng)LOLA服務(wù)器,其中含有一個或幾個服務(wù)器,例如數(shù)據(jù)庫服務(wù)器和創(chuàng)造物控制服務(wù)器,管理員站1710;教師站1720;學生編程站1740和無線電基地站1750。除了無線電基地站之外,所有主要子系統(tǒng)都由網(wǎng)絡(luò)手段互聯(lián),其中網(wǎng)絡(luò)手段例如有超文本傳送協(xié)議(HTTP)或中間件(MW),其中的中間件可以是任何適當?shù)慕涌谲浖?。典型地,除了無線電基地站之外,所有子系統(tǒng)都通過一個例如以太網(wǎng)(Ethernet)這樣的局域網(wǎng)(LAN)互聯(lián),而無線電基地站則由萬能串行總線(UniversalSerialBus,USB)連接。圖79是活對象實驗室(LOLA)系統(tǒng)的一個方框圖,其中示出了該系統(tǒng)所提供的一些主要(邏輯)服務(wù)數(shù)據(jù)庫引擎1760管理對數(shù)據(jù)庫1765的所有訪問。登錄服務(wù)器1770登錄在系統(tǒng)中運行的所有創(chuàng)造物和任務(wù)的執(zhí)行情況和性能的細節(jié)。監(jiān)視器引擎1775實時地向用戶提供在監(jiān)視時間上系統(tǒng)所執(zhí)行的任務(wù)的性能的信息。安全管理器1780監(jiān)督所有訪問該系統(tǒng)的用戶,并根據(jù)管理員預(yù)定的條件確認只有被授權(quán)的用戶才可以訪問數(shù)據(jù)庫的某些特定部分。任務(wù)管理器1785根據(jù)被授權(quán)用戶所提出的規(guī)定來監(jiān)督系統(tǒng)中所有任務(wù)的操作,典型地,這些服務(wù)由一些獨立的軟件子系統(tǒng)提供,這些子系統(tǒng)通過HTTP和MW等普通通信手段相互連接。圖80是系統(tǒng)管理員利用系統(tǒng)管理員站1200可得到的一個些主要服務(wù)的方框圖。典型地,這些服務(wù)包括在線控制臺1800,用于當系統(tǒng)工作正常時對所有可得到的服務(wù)的控制。脫機控制臺1810,用于當系統(tǒng)因進行重大安裝和維修而關(guān)閉時對所有可得到的服務(wù)的控制。配置控制臺1820,它使系統(tǒng)管理員能裝設(shè)硬件周邊設(shè)備,建立網(wǎng)絡(luò)配置等等。調(diào)度控制臺1830,它使系統(tǒng)管理員能設(shè)置新的創(chuàng)造物或改變已有創(chuàng)造物的配置。圖81是創(chuàng)造物控制服務(wù)器軟件的主要模塊的方框圖,其中的創(chuàng)造物控制服務(wù)器可以是一個獨立的服務(wù)器,也可以是例如總LOLA服務(wù)器這樣的另一個服務(wù)器的一部分。創(chuàng)造物控制服務(wù)器由許多代理對象1840組成,每個代理對象負責一個特定的創(chuàng)造物和一個計劃器任務(wù),該計劃器任務(wù)負責各種代理對象的操作的協(xié)調(diào)和時序。圖82是學生利用編程站可得到的一些主要服務(wù)的方框圖。這些服務(wù)以一些通過例如HTTP和MW等接口互相連接的模塊來實現(xiàn)。三種主要的模塊/服務(wù)器是交互作用開發(fā)環(huán)境(IDE)1860,它使學生能進行對指定給他(她)的作業(yè)(任務(wù))的編程;仿真器1870,它使學生能利用在計算機屏幕上模擬的虛擬創(chuàng)造物來測試所建立的程序;以及任務(wù)記錄器1880,它使學生能把所建立的程序記錄下來,供物理創(chuàng)造物執(zhí)行。圖83是教師利用教師站能得到的一些主要服務(wù)的方框圖,除了另外有一個教師控制臺使教師能給學生指定任務(wù)(作業(yè))并監(jiān)視他們的完成情況和打分等等之外,這些服務(wù)及其模塊式結(jié)構(gòu)與編程站的是相同的。圖84至93一起構(gòu)成了對LOLA的一個演示性示范項目的總體說明。圖84是一個示范性LOLA的方框圖,其中含有兩個班級,每個班級有5個編程站、1個教師站、一個直接連接在網(wǎng)絡(luò)上的無線電基地站和一個創(chuàng)造物。此外,在兩個班級之外,還有一個LOLA服務(wù)器、一個管理員站和一個也是直接連接在網(wǎng)絡(luò)上的無線電基地站,該基地站控制著4個創(chuàng)造物。圖85是說明安裝該示范性實驗室的方法和功能的方框圖,它在管理員級別上和兩個班中使用。圖86和87說明該示范性系統(tǒng)的軟件和硬件的結(jié)構(gòu)。圖88至90是說明激勵該示范性項目的演示程序的步驟的流程圖。圖91說明該示范性系統(tǒng)的一些主要應(yīng)用模塊。圖92和93說明為使該LOLA系統(tǒng)工作所需采取的步驟。圖92列出為激勵示范性演示軟件所必需安裝的一些軟件模塊。圖93列出為了在能執(zhí)行圖88和89所示的活動之前必需進行的配置活動。只要所有步驟都能完全地執(zhí)行,它們的執(zhí)行次序并不重要。圖94至105說明交互作用式開發(fā)環(huán)境(IDE)的結(jié)構(gòu)和特性。圖94示出IDE屏幕的典型結(jié)構(gòu)。該屏幕的典型組成是如所有Windows(視窗)應(yīng)用所共有的一個頂部菜單條2000和一個底部狀態(tài)條2005;例如2010和2020等工具條,它們可設(shè)置在屏幕上任何處,圖中示出的是在靠近頂部菜單條處。工具條2010中含有編程人可得到的各種軟件工具的圖標,例如編輯、編評、仿真等的圖標。編程工具條2020中含有編程人可以列入軟件程序中的各種目標的圖標,例如狀態(tài)、事件、功能等的圖標??梢詮墓ぞ邨l中拉出一個目標放入編程窗2030,以與該窗內(nèi)的其他目標連接。當選出一個目標時,在目標檢驗窗2040中將顯示出該特定目標的性質(zhì),編程人可以修改這些性質(zhì)的值,以生成所需的程序行為。當選擇了“仿真”時,將在仿真窗2050中顯示出被編程創(chuàng)造物的模擬像。當指令該創(chuàng)造物收集輸入數(shù)據(jù)(語音或觸覺傳感器)時,將跳出一個菜單2060,于是編程人可以通過該跳出式菜單中作出適當?shù)倪x擇來與創(chuàng)造物相互作用。消息窗2070在編程過程中將向編程人提供提示,在仿真過程中將向編程人提供程序執(zhí)行的跟蹤數(shù)據(jù)。圖95示出編程人可得到的一些主要功能(文件、編輯、觀看等)和一些子功能,主要功能顯示在IDE屏幕的頂部菜單條2000中,子功能是在選擇了一個主要功能后在一個下拉式窗口中示出的。圖96A和96B示出用戶可以目標工具條2010和編程工具條2020中得到的一些主要目標和編程工具。圖97更詳細地說明了目標檢驗窗2040。圖98說明各種情況下在消息窗2070中向編程人顯示的一些主要消息組。這些消息組是編程句法錯誤,編譯錯誤,例如編譯,找錯等各種功能的進程說明消息,系統(tǒng)在找錯時提供的測試登錄消息。圖99是仿真處理和模塊結(jié)構(gòu)的方框圖。當“仿真”被激活時,IDE模塊2200將執(zhí)行被測試的程序,只是把創(chuàng)造物能執(zhí)行的指令發(fā)送給了虛擬創(chuàng)造物命令接口2210。接口2210識別創(chuàng)造物類型,并且被仿真的相應(yīng)創(chuàng)造物功能將選擇和操作相應(yīng)的功能2220,功能2220在計算機顯示屏上執(zhí)行虛擬創(chuàng)造物的相應(yīng)動作2230。圖100說明底部狀態(tài)條2005的結(jié)構(gòu)。圖101A至101D更詳細地說明當選擇了一個目標組時各種目標組的目標工具條2020的內(nèi)容和結(jié)構(gòu)。圖101A是圖96A中2100的詳細情況,圖101B是圖96A中2110的詳細情況,圖101C是圖96A中2120的詳細情況,圖101D是圖96A中2130的詳細情況。情感分析概念性說明活對象實驗室LOLA的目的是教導學生把人類行為灌注到計算機化的機器中去的技術(shù)。人類的一個主要特性是能感知情感。也就是說,能識別另一個人的情感狀態(tài)和狀態(tài)改變并作出相應(yīng)的反應(yīng)。向人類教導情感感知是十分困難的,而要把情感感知植入到機器中去則更要困難得多,然而,當機器具有即使是簡單的情感感知時,也會對人機交互作用有巨大的作用。因此對情感感知的編程是重要的。情感分析的主要目的是給主要應(yīng)用以能適應(yīng)與機器交流的人的情感狀態(tài)的能力。情感分析是一種背景處理。情感分析評估與活對象交流的人的情感狀態(tài)。這個評估是與其他處理并行地連續(xù)進行的。按照應(yīng)用系統(tǒng)的復雜程度和編程的難易程度,該處理可以作為一個被主處理調(diào)用的子程序或作為一項背景任務(wù)來執(zhí)行。主要模塊(或處理)的對象是應(yīng)用的主要目的(例如扮演教師、保護人、響導、玩件等角色)。情感分析與主要任務(wù)通信,接收必要的輸入,并向主要應(yīng)用提供一系列應(yīng)對與之交流的人作出的適當反應(yīng)。情感分析大部分是語言上的。情感分析處理將分析由主要應(yīng)用所記錄的語言輸入內(nèi)容。根據(jù)分析結(jié)果,情感分析將向主要應(yīng)用提供適當?shù)臄?shù)據(jù)。由情感分析處理向主要處理提供的數(shù)據(jù)可以從相互作用人的可看到的情感狀態(tài)或情感狀態(tài)改變一直到準備讓主要處理放送的詳細語句。向情感分析提供的輸入和是否遵從情感分析的輸出,其最終決策在于主要(應(yīng)用)處理。情感分析基本上是一個程序,它可以用與編制主要應(yīng)用相同的現(xiàn)成編程工具來編程。情感分析程序可以看作是一個實現(xiàn)成狀態(tài)引擎的算法,該引擎中的事件是從與使用人的交流中接收到(記錄下)的語言輸入的語音分析和語義分析以及所積累的數(shù)據(jù)的結(jié)合。情感分析處理的設(shè)計涉及到幾個階段,例如確定情感的種類范圍,例如三種情感悲傷、快樂和憤怒;確定準確在從與使用人的交流中接收到(記錄下)的語言輸入中探測出的情感的語音和語義表示,例如,語聲幅度(輕聲或高聲)、語音的音調(diào)、語速、收錄質(zhì)量(語言識別質(zhì)量)、和特定語詞(如“悲傷”、“快樂”、“憤怒”)。當然,上述某一特征的變化可能會比該特征本身更重要,例如,提高聲音可能比連續(xù)的高聲傳遞更多的情感信息;確定明確地詢問交流人的情感的方法,例如直接提出“你悲傷嗎?”這樣的問題;根據(jù)所探測到的交流人的情感狀態(tài),確定對應(yīng)用的相互作用所進行的修改。應(yīng)該首先確定修改的目的,然后再確定方法。其中,修改目的的例子有表達同情,提供情感支持和鼓勵等,以及影響(改變)情感種類;方法的例子有采取適當?shù)恼Z言輸出幅度(響度)、調(diào)門、和速度,準備要選擇和放送的同一語言內(nèi)容的幾種版本,表達同情、感興趣、支持等的約定/標準短語;確定應(yīng)用處理與情感分析處理之間通信方法(協(xié)議)。給學生的編程項目打分通常,教師根據(jù)一個檢查清單來評估考慮和打分。對于從精確的科學直到人類學等所有的命題考試都是這樣來評估和打分的。對于編程(從分析、設(shè)計、到實施)的評估來說也是這樣做的。檢查清單評估可以自動進行,也即由計算機進行。由于對考卷的計算機評估的機制是很普通的,并且對所有命題考試都是一樣的,所以這已不屬于本文的范疇。編出的程序還應(yīng)該能正確地運行,也就是說應(yīng)能符合規(guī)定要求不出錯(不失敗)地靠其自身運行。顯然,計算機能夠跟蹤被運行程序的性能,根據(jù)規(guī)定分析其性能,和報告結(jié)果。自動(或計算機)評估通過一個監(jiān)視程序來實行,該監(jiān)視程序能記錄被監(jiān)視程序的性能,分析記錄,和報告結(jié)果。為了實現(xiàn)監(jiān)視,在被監(jiān)視程序中需設(shè)置一些檢查點,并且監(jiān)視程序應(yīng)同時記錄通過每個這種檢查點的情況和相應(yīng)的參數(shù)值。LOLA的約定監(jiān)視將提供對每個狀態(tài)的入口和出口(從而提供對每個狀態(tài)改變/連接的入口和出口)。監(jiān)視程序應(yīng)報告對每個學生的每個程序模塊的監(jiān)視結(jié)果??梢愿鶕?jù)以下一些標準來打分已進入的(從而已測試過的)的狀態(tài)和狀態(tài)連接的百分比;已退出的(從而表明已成功運行的)狀態(tài)和狀態(tài)連接的百分比;內(nèi)部性能的平衡情況,它是兩個數(shù)的比值,第一個數(shù)對最少訪問(最多訪問)的實體(狀態(tài)、連接)的進口(出口)數(shù),第二個數(shù)是模塊(每個模塊和各個模塊)內(nèi)的平均入口(出口)數(shù)。更精確地說,平衡情況是清單中各入口(出口)和各最多訪問實體與平均值之間的差值的平方和的平方根;總體性能平衡情況,它是模塊中的進口(出口)數(shù)與項目的平均數(shù)的比值。圖103是說明情感分析數(shù)據(jù)庫的一個表格。圖104是一個情感分析狀態(tài)圖。情感分析設(shè)備能探測到用戶情感狀態(tài)的變化。情感狀態(tài)的變化與用戶語言特征的變化有關(guān),這些特征例如有響度、速度、音調(diào)(以下是隱含特征的例子)以及用戶所使用的特定詞條和對創(chuàng)造物所提出的直接約定問題的回答(以上是顯特征的例子)。每個這種特征事件都有一個權(quán)重,當發(fā)生某一事件時將在相應(yīng)的表格單元中增大權(quán)重。僅當超過某一閾值時創(chuàng)造物才會對探測到的狀態(tài)變化作出響應(yīng)(提供同情,提出一個約定的問題等)。圖105-110說明Uniport(單端口)的一個優(yōu)選實施例,其中包括了一個軟件體系的總貌。圖105示出一些典型的功能調(diào)用和返回說明。圖106示出適用于媒體BIOS模塊的典型輸入數(shù)據(jù)處理。圖107示出適用于UCP實現(xiàn)模塊的典型輸入數(shù)據(jù)處理。圖108示出適用于用戶應(yīng)用和API模塊的典型輸出數(shù)據(jù)處理,圖109示出一個典型的UCP實現(xiàn)模塊和媒體BIOS輸出數(shù)據(jù)處理。圖110示出協(xié)議實現(xiàn)模塊和媒體BIOS模塊的輸出數(shù)據(jù)處理,在圖110中,MAX-OB代表輸出緩存器中各單元的最大值。下面是一些典型輸出功能的說明crsrAddWords這個功能用來從語言識別引擎向活動正文添加詞條。crWaitForEvent這個功能用來等待來自UNIT的事件。bioTransferReset這個功能用來復原Media(媒體)BIOS模塊中的輸入或/和輸出隊列(見圖5,2)。關(guān)于3.2協(xié)議實現(xiàn)模塊的輸出功能的說明。proSystemOpen這個功能用來打開系統(tǒng)。proSystemeLose這個功能用來關(guān)閉系統(tǒng)。proSendMessage這個功能用來發(fā)送控制消息。proSendBuffer這個功能用來發(fā)送緩存。proTransferReset這個功能用來復原MediaBIOS模塊中的輸入或/和輸出隊列。關(guān)于3.2API模塊輸出功能的說明。crBaseDetect這個功能用來探測BASE(基地)(確定裝置的識別符ID)。crSystemOpen這個功能用來打開系統(tǒng)。crSystemClose這個功能用來關(guān)閉系統(tǒng)。crSetNotification這個功能用來設(shè)置用戶應(yīng)用中的回呼說明機制。crSendBuffer這個功能用來發(fā)送緩存。crSendMessage這個功能用來發(fā)關(guān)消息。crUnitTalk這個功能用來放送聲音文件。crGetBaseVersion這個功能用來從BASE獲得版本號。crsrGetWords這個功能用來從語言識別引擎的有效正文獲得所有詞語。crsrCreateContext這個功能用來在語言識別引擎中生成新的正文。crsrDeleteContext這個功能用來在語言識別引擎中刪除正文。crsrSelectContext這個功能用來從語言識別引擎選擇正文。crsrRemoveWords這個功能用來從語言識別引擎的有效正文去除詞語。關(guān)于3.1Media(媒體)BIOS模塊輸出功能的說明bioMediaConnect這個功能用來連接到通信媒體上。bioMediaDisconnect這個功能用來斷開與通信媒體的連接。bioAddOutBuffer這個功能用來把輸出緩存添加到輸出隊列上(見圖5)。圖111-115一起構(gòu)成了玩具配置的流程圖。圖111說明典型的人物(figure)配置。圖112-115說明典型的安裝-檢驗(分別為BT的四之一、四之二、四之三、四之四)。為了產(chǎn)生一個屏幕接口,可以記錄下述用作屏幕文本的帶聲voice-over內(nèi)容屏幕0010-0012進入前言早上嗨,早上好!下午嗨,不錯吧,下午好!晚上嗨,晚—安!屏幕0040關(guān)于你(ABOUTYOU)叩擊這里以給出或改變用戶信息。屏幕0050熱叩擊!(HOTCLIP!)叩擊這里可看到說故事人跳舞和唱歌。屏幕0600如何玩(HOWT0PLAY)叩擊這里可聽到教你如何玩。屏幕0070起動游戲(PLAY)叩擊這里可以開始游戲。屏幕0080**新檢查(**NEWCHECK-UP)叩擊這里可以檢查系統(tǒng)。屏幕0090退出(EXIT)叩擊這里可以關(guān)閉說故事人程序。屏幕0041雙擊用戶名或鍵入新用戶的姓名。如果是鍵入新的姓名,則鍵入完后按“ENTER”鍵。屏幕0042請鍵入新用戶的姓名。鍵入完后按下ENTER鍵。屏幕0043當我們一起玩時,我將用一個秘密名字來叫你?,F(xiàn)在請雙擊你想要的秘密名字。當他們沒有選擇秘密名字時我必須首先知道你的秘密名字?,F(xiàn)在趕快選擇一個秘密名字。關(guān)于你(ABOUTYOU)叩擊這里以告訴我有關(guān)你的一切。填寫個人數(shù)據(jù)的說明1、叩擊位于某一項處的光標。2、將呈現(xiàn)一個菜單。作出你的選擇。3、逐項地重復上述過程。4、完成后叩擊主菜單(MAINMENU)鈕。在“關(guān)于你”(ABOUTYOU)/“秘密名字”(AECRETNAME)/“愛好”(FAVORITES)屏幕頂部的關(guān)于輸入數(shù)據(jù)的一般邀請請告訴我關(guān)于你的一切。我很樂意了解你。愛好(FAVORITES)叩擊這里來選擇你愛好的事物?!つ阆矏凼裁搭伾奎S?紅?藍?選一個?!つ阆矏凼裁词称罚勘人_餅?通心粉和奶酪?炸薯條?選一個?!つ阆矏凼裁椿顒??玩騙人相信?畫畫?玩計算機游戲?選一個。你喜愛什么動物?貓、狗、馬?選一個。光標圖(GRAPHICOFCURSOR)叩擊這里以返回“說故事人”的主菜單。應(yīng)該看到,如果需要,本發(fā)明的軟件部分可以用ROM(只讀存儲器)的形式的實現(xiàn)。一般,如果愿意,軟件部分可以用普通技術(shù)以硬件的形式實現(xiàn)。應(yīng)該看到,附錄中所說明的具體實施例只是為了提供本發(fā)明的一個極詳細的公開內(nèi)容,而不是為了限制本發(fā)明。應(yīng)該看到,為了清楚而在各個分開的實施例的說明文中說明的本發(fā)明的各種特征也可以結(jié)合在一個實施例中給出。反之,為了簡短而在一個實施例的說明文中說明的本發(fā)明的各種特征也可以完全分開地說明或組合成任何適當?shù)淖咏M合來說明。附錄A應(yīng)用源代碼<prelisting-type="program-listing"xml:space="preserve"><![CDATA[===============================  Copyrignt(c)1995-1998CreatorLtd.AllRightsReserved================================DescriptionThisistheMainunit.unitMain;interfaceusesWindows,Messages,SysUtils,Classes,Graphics,Controls,F(xiàn)orms,Dialogs,StdCtrls,Toy,PDBEngine,XMIDILib_TLB,OleCtrls,NEWSRLib_TLB,ExtCtrls,MPlayer,ComCtrls,jpeg,Menus;typeTTalkThread=class(TThread)  private  ToyNumberInteger;  TalkFilestring;  MotionInteger;  protected  constructorcreate(ToyNumberlInteger;TalkFilelstring;MotionlInteger);  procedureExecute;override;  end;TMainForm=class(TForm)  ButtonlTButton;  SRlTSR;  XMidilTXMidi;  MainMenulTMainMenu;  testlTMenuItem;  spacelTMenuItem;  PanellTPanel;  MediaPlayerlTMediaPlayer;  TimerlTTimer;  procedureFormCreate(SenderTObject);  procedureFormClose(SenderTobject;varActionTCloseAction);  procedurespacelClick(SenderTObject);  procedureTimerlTimer(SenderTObject);private  (Privatedeclarations)TalkingInThreadTTalkThread;  public  (Publicdeclarations)  CurrentPathstring;  CreatorPathstring;  DatabasePathstring;  GraphicsPathstring;  AudioPathstring;  UsagePathstring;  AboutYouPathstring;  ToyTToy;  ToyMachinestring;  PDBEngineTPDBEngine;  ThreadInProgressBoolean;  ToyNameIsStoryTellerstring;  ToyNameIsBearstring;  procedureApplicationInitialization;  procedureGotoMainMenu;  procedureGotoCreator;  functionBackGroundTalking(TalkFilestring;Motionstring)Integer;  functionGetCurrentPath(CurrentExeNamestring)string;  functionTalkInBackGround(ToyNumberInteger;TalkFilestring;  Motionstring)Integer;end;varMainFormTMainForm;implementationusesMenu,Status,creator;(SR*.DFM)procedureTMainForm.FormCreate(SenderTObject);begin//screen.cursor=crDefault;ToyNameIsStoryTeller=′StoryTeller′;ToyNameIsBear=′TeddyBear′;Screen.Cursors[5]=LoadCursor(HInstance,′PestoHand.Cur′);  Screen.Cursors[6]=LoadCursor(HInstance,′PestoMenu.Cur′);  cursor=5;  ApplicationInitialization;  Cursor=crNone;  Timerl.Interval=1000;  Timerl.Enabled=True;  if(Toy.ToyNumber>0)and(Toy.ToyNumber<32)thenToyMachine=ToyNameIsBear  elseToyMachine=ToyNameIsStoryTeller;end;procedureTMainForm.ApplicationInitialization;begin//FillPathes  CurrentPath=GetCurrenfPath(Application.ExeName);  CreatorPath=Copy(CurrentPath,1,Length(CurrentPath)-Length(′Executables\′));  //CreatorPath=Copy(Application.ExeName,1,  //Length(Application.ExeName)-27);  DatabasePath=CreatorPath+′PESTO\DATABASE\′;  GraphicsPath=CreatorPath+′PESTO\GRAPHICS\′;  AudioPath=CreatorPath+′PESTO\AUDIO\′;  UsagePath=CreatorPath+′PESTO\USAGE\′;  PDBEngine=TPDBEngine.create(self);  PDBEngine.DataBasePath=DatabasePath;  PDBEngine.LoadRegistration;  PDBEngine.SetChildNumber(1);  PDBEngine.LoadConfiguration;  Toy=TToy.Create(self);  Toy.ToyNumber=PDBEngine.ToyNumber;  Toy.TurnOn;  Application.Icon.LoadFromFile(GraphicsPath+′PestoIcon.ico′);  AboutYouPath=AudioPath+′AboutYou\′;end;functionTMainForm.GetCurrentPath(CurrentExeNamestring)string;variinteger;begini=Length(CurrentExeName);Whilei>0dobeginifCopy(CurrentExeName,i,l)=′\′theni=0  else  begin  i=i-1;  CurrentExeName=Copy(CurrentExeName,l,i);  end;  end;  Result=CurrentExeName;end;procedureTMainForm.GotoMainMenu;begin  ifTime<StrToTime(′120000′)then  BackGroundTalking(AboutYouPath+′vo001.wav′,′S′)  else  ifTime>StrToTime(′160000′)then  BackGroundTalking(AboutYouPath+′vo003.wav′,′5′)  else  BackGroundTalking(AboutYouPath+′vo002.wav′,′S′);  Spacel.Enabled=False;  Hide;  Timerl.Enabled=False;  MenuForm.Show;end;procedureTMainForm.FormClose(SenderTObject;varActionTCloseAction);beginifThreadInProgressthenExit;Toy.TurnOff;Toy.Free;PDBEngine.Free;end;procedureTMainForm.spacelClick(SenderTObject);begin//spaceGotoCreator;end;procedureTMainForm.GotoCreator;beginSpacel.Enabled=False;  Hide;  CreatotForm.Show;  CreatorForm.PlayMovie;  Timerl.Enabled=False;end;functionTMainForm.BackGroundTalking(TalkFilestring;Motionstring)Integer;var  ThreadlTTalkThread;begin  ThreadInProgress=True;  Threadl=TTalkThread.create(Toy.ToyNumber,TalkFile,0);  Result=0;end;functionTMainForm.TalkInBackGround(ToyNumberInteger;TalkFilestring;  Motionstring)Integer;varThreadlTTalkThread;beginThreadInProgress=True;Threadl=TTalkThread.create(ToyNumber,TalkFile,0);Result=0;end;constructorTTalkThread.create(ToyNumber1Integer;TalkFile1string;MotionlInteger);begininheritedcreate(False);ToyNumber=ToyNumber1;TalkFile=TalkFile1;Motion=Motionl;FreeOnTerminate=True;end;procedureTTalkThread.Execute;begin  //85=55HBroadCast  if(MainForm.ToyMachine=′StoryTeller′)and(ToyNumber<>85)then  MainForm.XMidil.ToyTalk2(ToyNumber,TalkFile,0,0,Motion,0);  if(MainForm.ToyMachine=′TeddyBear′)or(ToyNumber=85)thenMainForm.XMidil.NewToyTalk(ToyNumber,TalkFile,0,9,0);  Terminate;  MainForm.ThreadInProgress=False;Exit;end;procedureTMainForm.TimerlTimer(SenderTObject);begin//GotoCreator;GotoMainMenu;end;end.================================  Copyright(c)1995-1998CreatorLtd.AllRightsReserved================================DescriptionThisistheCheckupunit.unitCheckUp;interrfaceusesWindows.Messages,SysUtils,Classes,Graphics,Controls,F(xiàn)orms,Dialogs,ExtCtrls.Jpeg.ComCtrls;typeTCheckUpForm=class(TForm)ImagelTImage;ExitImageTImage;CarAnimateTAnimate;ClownAnimateTAnimate;DuckAnimateTAnimateDuckWalkAnimateTAnimate;LightOrganAnimateTAnimate;LogoMoveAnimateTAnimate;MicrophoneAnimateTAnimate;MotionLetersAnimateTAnimate;SensorAnimateTAnimate;SpeakerAnimateTAnimate;Image2TImageprocedureExitImageClick(SenderTObject);procedureFormCreate(SenderTObject);procedureImage2Click(SenderTObject);private{Privatedeclarations}pubiic{Pubiicdeclarations}procedureActivateTheAnimation(valueboolean);end;varCheckUpFormTCheckUpFormimplementationusesMenu.Main{SR*.DFM}procedureTCheckUpForm.ExitImageClick(SenderTObject);begin//HideActivateTheAnimation(False);MenuForm.Show;end;procedureTCbeckUpForm.FormCreate(SenderTObject);begin//withCarAnimatedobeginFileName=MainFormGraphicsPath+′Car.avi′;Left=260;Top=441;Width=80;Height=60end;withClownAnimatedobeginFileName=MainFormGraphicsPath+′Clownavi′;Left=652;Top=393;Width=32;Height=40;end;withDuckAnimatedobeginFileName=MainForm.GraphicsPath+′Duckavi′Left=613;Top=114;Width=48;Height=50;end;withDuckWalkAnimatedobeginFileName=MainForm.GraphicsPath+′DuckWalk.avi′;Left=599;Top=216;Width=128;Height=115;end;withLightOrganAnimatedobeginFileName=MainForm.GraphicsPath+LightOrgan.avi′;Left=455;Top=440;Width=48;  Height=70;end;withLogoMoveAnimatedobegin  FileName=MainForm.GraphicsPath+′LogoMove.avi′;  Left=336;  Top=19;  Width=112;  Height=45;end;withMicrophoneAnimatedobegin  FileName=MainForm.GraphicsPath+′HubWave.avi′;  Left=95;  Top=365;  Width=80;Height=40;  end;  withMotionLetersAnimatedo  begin  FileName=MainForm.GraphicsPath+′MotionLeters.avi′;  Left=468;  Top=172;  Width=144;  Height=45;  end;  withSensorAnimatedo  begin  FileName=MainForm.GraphicsPath+′Sensor.avi′;  Left=341;  Top=227;  Width=96;  Height=60;  end;  withSpeakerAnimatedo  begin  FileName=MainForm.GraphicsPath+′Speaker.avi′;  Left=57;  Top=169;  Width=96;  Height=80;  end;end;procedureTCheckUpForm.ActivateTheAnimation(valueboolean);begin//  try  CarAnimate.Active=Value;  except  end;  try  ClownAnimate.Active=Value;  exceptend;  try  DuckAnimate.ActiveValue;  except  end;  try  DuckWalkAnimate.Active=Value;  except  end;  try  LightOrganAnimate.Active=Value;  except  end;  try  LogoMoveAnimate.Active=Value;  except  end;  try  MicrophoneAnimate.Active=Value;  except  end;  try  MotionLetersAnimate.Active=Value;  except  end;  try  SensorAnimate.Active=Value;  except  end;  try  SpeakerAnimate.Active=Value;  except  end;end;procedureTCheckUpForm.Image2Click(SenderTObject);begin////MainForm.Toy.TurnOff;sleep(5000);ActivateTheAnimation(False);close;MainForm.close;WinExec(PChar(MainForm.CurrentPath+′PESTOInstallation′),sw_show);Application.Terminate;end;end.================================  Copyright(c)1995-1998CreatorLtd.AllRightsReserved================================DescriptionThisistheCreatorunit.unitcreator;interfaceusesWindows,Messages,SysUtils,Classes,Graphics,Controls,F(xiàn)orms,Dialogs,Menus,ExtCtrls,MPlayer;typeTCreatorForm=class(TForm)  MainMenulTMainMenu;  testlTMenuItem;  spacelTMenuItem;  MediaPlayerlTMediaPlayer;  PanellTPanel;  TimerlTTimer;  EscapelTMenuItem;  procedurespacelClick(SenderTObject);  procedureTimerlTimer(SenderTObject);  procedureFormCreate(SenderTObject);  procedureEscapelClick(SenderTObject);  procedureFormClose(SenderTOdject;varActionTCloseAction);private  (Privatedeclarations)public  (Publicdeclarations)  StartPlayInteger;  procedurePlayMovie;  procedureGoToPestoSong;end;var  CreatorFormTCteatorForm;implementationusesPestoSong,Main,Menu;(SR*.DFM)procedureTCreatorForm.spacelClick(SenderTObject);begin//spaceGoToPestoSong;end;procedureTCreatorForm.GoToPestoSong;begin//Spacel.Enabled=False;MediaPlayerl.stop;MediaPlayerl.Close;hide;PestoSongForm.Show;PestoSongForm.PlayMovie;Timerl.Enabled=False;end;procedureTCreatorForm.PlayMovie;begin//try  Timerl.Enabled=True;  MediaPlayerl.Play;exceptend;end;procedureTCreatorForm.TimerlTimer(SenderTObject);begin//StartPlay=StartPlay+1;ifStartPlay=1thenexit;GoToPestoSong;end;procedureTCreatorForm.FormCreate(SenderTObject);begin//Timerl.Enabled=False;Panell.Cursor=crNone;  Timerl.Interval=17000;  StartPlay=0;  Cursor=crNone;  MediaPlayerl.FileName=MainForm.GraphicsPath+′Open0.avi′;end;procedureTCreatorForm.EscapelClick(SenderTObject);begin//Exit  try  MediaPlayerl.stop;  except  end;  try  MediaPlayerl.Close;  except  end;  Hide;  MenuForm.Show;end;procedureTCreatorForm.FormClose(SenderTObject;varActionTCloseAction);begin//Exit  try  MediaPlayerl.stop;  except  end;  try  MediaPlayerl.Close;  except  end;end;end.================================  Copyrignt(c)1995-1998CreatorLtd.AllRightsReserved================================DescriptionThisistheMenuunit.unitMenu;interfaceusesWindows,Messages,SysUtils,Classes,Graphics,Controls,F(xiàn)orms,Dialogs,StdCtrls,Buttons,ExtCtrls,ComCtrls,Intto,jpeg,Toy,Menus;typeTMenuForm=class(TForm)  MenuImageTImage;  SetupImageTImage;  AnimationImageTImage;  IntroImageTImage;  PlayImageTImage;  ExitImageTImage;  TVAnimateTAnimate;  PickUserImageTImage;  OKButtonImageTImage;  UserNameEditTEdit;  SetUpOrgImageTImage;  CheckImageTImage;  PickUserTitleLabelTLabel;  PickUserLabel1TLabel;  PickUserLabel2TLabel;  ImageFrame1TImage;  ImageFrame2TImage;  ImageFrame3TImage;  ImageFrame4TImage;  ImageFrame5TImage;  ImageErame6TImage;  UserNameLabel1TLabel;  UserNameLabel2TLabel;  UserNameLabel3TLabel;  UserNameLabel4TLabel;  UserNameLabel5TLabel;  UserNameLabel6TLabel;UserNameLabel7TLabel;UserNameLabel8TLabel;MainMenulTMalnMenu;testllTMenuItem;EnterlTMenuItem;EscapelTMenuItem;ToyImageTImage;ToyAnimateTAnimate;procedureFormCreate(SenderTObject);procedureUserName1ButtonClick(SenderTObject);procedureUserName2ButtonClick(SenderTObject);procedureUserName3ButtonClick(SenderTObject);procedureUserName4ButtonClick(SenderTObject);procedureUserName5ButtonClick(SenderTObject);procedureUserName6ButtonClick(SenderTObject);procedureUserName7ButtonClick(SenderTObject);procedureUserName8ButtonClick(SenderTObject);procedureUserName1ButtonMouseMove(SenderTObject;ShiftTShiftState;X,YInteger);procedureUserName2ButtonMouseMove(SenderTObject;ShiftTShiftState;X,YInteger);procedureUserName3ButtonMouseMove(SenderTObject;ShiftTShiftState;X,YInteger);procedureUserName4ButtonMouseMove(SenderTObject;ShiftTShiftState;X,YInteger);procedureUserNameSButtonMouseMove(SenderTObject;ShiftTShiftState;X,YInteger);procedureUserName6ButtonMouseMove(SenderTObject;ShiftTShiftState;X,YInteger);procedureUserName7ButtonMouseMove(SenderTObject;ShiftTShiftState;X,YInteger);procedureUserName8ButtonMouseMove(SenderTObject;ShiftTShiftState;X,YInteger);procedureOKButtonImageClick(SenderTObject);procedureImageFrame1MouseMove(SenderTObject;ShiftTShiftState;X,YInteger);procedureImageFrame2MouseMove(SenderTObject;ShiftTShiftState;X,YInteger);procedureImageFrame3MouseMove(SenderTObject;ShiftTShiftState;X,YInteger);procedureImageFrame4MouseMove(SenderTObject;ShiftTShiftState;X,YInteger);procedureImageFrame5MouseMove(SenderTObject;ShiftTShiftState;X,YInteger);  procedureImageFrame6MouseMove(SenderTObject;ShiftTShiftState;X,  YInteger);  procedureImageFrame1Click(SenderTObject);  procedureImageFrame2Click(SenderTObject);  procedureImageFrame3Click(SenderTObject);  procedureImageFrame4Click(SenderTObject);  procedureImageFrame5Click(SenderTObject);  procedureImageFrame6Click(SenderTObject);  procedureMenuImageMouseMove(SenderTObject;ShiftTShiftstate;X,  YInteger);  procedureEnterlClick(SenderTObject);  procedureEscapelClick(SenderTObject);  procedureFormClose(SenderTObject;varActionTCloseAction);private(Privatedeclarations)  procedureResetCurrentButton;  procedureUserNameDefaultColor;  procedureClearUserName;  procedureAssignCursorsInImages;  procedureShowRegistration(Valuestring);public  (Publicdeclarations)  ThreadlTIntro;  CurrentButtonString;end;varMenuFormTMenuForm;constcrPESTOHandCursor=100;crPESTOMenuCursor=101;implementationusesMain,Status,Registration,ToySimulation,MotionSimulation,CheckUp,PestoSong,SingAlong,creator;(SR*.DEM)procedureTMenuForm.ResetCurrentButton;beginifCurrentButton=′SetUp′thenSetupImage.Visible=False;  ifCurrentButton=′Animation′thenAnimationImage.Visible=False;  ifCurrentButton=′Intro′thenIntroImage.Visible=False;  ifCurrentButton=′Play′thenPlayImage.Visible=False;  ifCurrentButton=′Check′thenCheckImage.Visible=False;  ifCurrentButton=′Exit′thenExitImage.Visible=False;end;procedureTMenuForm.FormCreate(SenderTObject);begin  Screen.Cursors[crPESTOHandCursor]=  LoadCursor(HInstance,′PESTOHAND.CUR′);  Screen.Cursors[crPESTOMenuCursor]=  LoadCursor(HInstance,′PESTOMENU.CUR′);  TVAnimate.FileName=MainForm.GraphicsPath+′Noise.AVI′;  TVAnimate.Active=True;  MainForm.Hide;  Threadl=nil;  SetupImage.Visible=True;  SetUpOrgImage.Visible=False;  AnimationImage.Visible=False;  IntroImage.Visible=False;  PlayImage.Visible=False;  CheckImage.Visible=False;  ExitImage.Visible=False;  SetupImage.cursor=crPESTOMenuCursor;  SetUpOrgImage.cursor=crPESTOMenuCursor;  AnimationImage.cursor=crPESTOMenuCursor;  IntroImage.cursor=crPESTOMenuCursor;  PlayImage.cursor=crPESTOMenuCursor;  CheckImage.cursor=crPESTOMenuCursor;  ExitImage.cursor=crPESTOMenuCursor;  ImageFrame1.cursor=crPESTOHandCursor;ImageFrame2.cursor=crPESTOHandCursor;  ImageFrame3.cursor=crPESTOHandCursor;  ImageFrame4.cursor=crPESTOHandCursor;  ImageFrame5.cursor=crPESTOHandCursor;  ImageFrame6.cursor=crPESTOHandCursor;  OKButtonImage.Cursor=crPESTOHandCursor;  CurrentButton=′SetUp′;//UnvisibleRegistration  PickUserImage.Visible=False;  //Reg1  PickUserTitleLabel.Visible=False;  UserNameLabel1.Visible=False;  UserNameLabel2.Visible=False;  UserNameLabel3.Visible=False;  UserNameLabel4.Visible=False;  UserNameLabel5.Visible=False;  UserNameLabel6.Visible=False;  UserNameLabel7.Visible=False;  UserNameLabel8.Visible=False;  //Reg2  PickUserLabel1.Visible=False;  PickUserLabel2.Visible=False;  UserNameEdit.Visible=False;  OKButtonImage.Visible=False;  //  Cursor=crPESTOMenuCursor;  //AssignCursorsInImages;  UserNameLabel1.Caption=′NEWUSER′;  WithToyAnimatedo  begin  FileName=MainFom.GraphicsPath+′Eye.AVI′;  Active=True;  Left=376;  Top=252;  Width=80;  Height=40;  end;  WithToyImagedo  begin  Left=265;Top=177;  Width=309;  Height=368;  end;end;procedureTMenuForm.UserName1ButtonClick(SenderTObject);begin//  ifMainForm.ThreadInProgressthenexit;  PickUserTitleLabel.Visible=False;  UserNameLabel1.Visible=False;  UserNameLabel2.Visible=False;  UserNameLabel3.Visible=False;  UserNameLabel4.Visible=False;  UserNameLabel5.Visible=False;  UserNameLabel6.Visible=False;  UserNameLabel7.Visible=False;  UserNameLabel8.Visible=False;  UserNameEdit.Text=′’′;  PickUserLabel1.Visible=True;  PickUserLabel2.Visible=True;  UserNameEdit.Visible=True;  OKButtonImage.Visible=True;  UserNameEdit.SetFocus;  MainForm.PDBEngine.InsertNewChild;  MainForm.BackGroundTalking(MainForm.AboutYouPath+′vo0042.wav′,′S′);end;procedureTMenuForm.UserName2ButtonClick(SenderTObject);begin//ifMainForm.ThreadInProgressthenexit;MainForm.PDBEngine.SetChildNumber(1);ShowRegistration(UserNameLabel2.Caption);end;procedureTMenuForm.UserName3ButtonClick(SenderTObject);begin//ifMainFoLm.ThreadInProgressthenexit;MainFom.PDBEngine.SetChildNumber(2);ShowRegistration(UserNameLaoel3.laptlon;end;procedureTMenuForm.UserName4ButtonClick(SenderTObject);begin//  ifMainForm.ThreadInProgressthenexit;  MainForm.PDBEngine.SetChildNumber(3);  ShowRegistration(UserNameLabel4.Caption);end;procedureTMenuForm.UserName5ButtonClick(SenderTObject);begin//  ifMainForm.ThreadInProgressthenexit;  MainForm.PDBEngine.SetChildNumber(4);  ShowRegistration(UserNameLabel5.Caption);end;procedureTMenuForm.UserName6ButtonClick(SenderTObject);begin//ifMainForm.ThreadInProgressthenexit;MainForm.PDBEngine.SetChildNumber(5);ShowRegistration(UserNameLabel6.Caption);end;proceureTMenuForm.UserName7ButtonClick(SenderTObject);begin//ifMainForm.ThreadInProgressthenexit;MainForm.PDBEngine.SetChildNumber(6);ShowRegistration(UserNameLabel7.Caption);end;procedureTMenuForm.UserName8ButtonClick(SenderTObject);begin//ifMainForm.ThreadInProgressthenexit;MainForm.PDBEngine.SetChildNumber(7);ShowRegistration(UserNameLabel8.Caption);end;procedureTMenuForm.UserName1ButtonMouseMove(SenderTObject;ShiftTShiftState;X,YInteger);begin//  ifUserNameLabel1.Font.Color<>clGreenthen  begin  UserNameDefaultColor;  UserNameLabel1.Font.Color=clGreen;  end;end;procedureTMenuForm.UserNameDefaultColor;var  UserColorTColor;begin//  UserColor=clRed;  UserNameLabel1.Font.Color=UserColor;  UserNameLabel2.Font.Color=UserColor;  UserNameLabel3.Font.Color=UserColor;  UserNameLabel4.Font.Color=Usercolor;  UserNameLabel5.Fonc.Color=UserColor;  UserNameLabel6.Font.Color=Usercolor;  UserNameLabel7.Font.Color=UserColor;  UserNameLabel8.Font.Color=UserColor;end;procedureTMenuForm.UserName2ButtonMouseMove(SenderTObject;ShiftTShiftState;X,YInteger);begin//ifUserNameLabel2.Font.Color<>clGreenthen  begin  UserNameDefaultColor;  UserNameLabel2.Font.Color=clGreen;  end;end;procedureTMenuForm.UserName3ButtonMouseMove(SenderTObject;ShiftTShiftState;X,YInteger);begin//ifUserNameLabel3.Font.Color<>clGreenthen  begin  UserNameDefaultColor;  UserNameLabel3.Font.Color=clGreen;  end;end;procedureTMenuForm.UserName4ButtonMouseMove(SenderTObject;ShiftTShiftState;X,YInteger);begin//  ifUserNameLabel4.Font.Color<>clGreenthen  begin  UserNameDefaultColor;  UserNameLabel4.Font.Color=clGreen;  end;end;procedureTMenuForm.UserName5ButtonMouseMove(SenderTObject;ShiftTShiftState;X,YInteger);begin//  ifUserNameLabel5.Font.Color<>clGreenthen  begin  UserNameDefaultColor;  UserNameLabel5.Font.Color=clGreen;  end;end;procedureTMenuForm.UserName6ButtonMouseMove(SenderTObject;ShiftTShiftState;X,YInteger);begin//  ifUserNameLabel6.Font.Color<>clGreenthen  begin  UserNameDefaultColor;  UserNameLabel6.Font.Color=clGreen;  end;end;procedureTMenuForm.UserName7ButtonMouseMove(SenderTObject;ShiftTShiftState;X,YInteger);begin//  ifUserNameLabel7.Font.Color<>clGreenthen  begin  UserNameDefaultColor;  UserNameLabel7.Fonr.Color=clGreen;  end;end;procedureTMenuForm.UserName8ButtonMouseMove(SenderTObject;ShiftTShiftState;X,YInteger);begin//  ifUserNameLabel8.Font.Color<>clGreenthen  begin  UserNameDefaultColor;  UserNameLabel8.Font.Color=clGreen;  end;end;procedureTMenuForm.ClearUserName;begin//  PickUserImage.Visible=False;  UserNameLabel1.Visible=False;  UserNameLabel2.Visible=False;  UserNameLabel3.Visible=False;  UserNameLabel4.Visible=False;  UserNameLabel5.Visible=False;  UserNameLabel6.Visible=False;  UserNameLabel7.Visible=False;  UserNameLabel8.Visible=False;  UserNameEdit.Visible=False;  OKButtonImage.Visible=False;end;procedureTMenuForm.OKButtonImageClick(SenderTObject);begin//ifMainForm.ThreadInProgressthenexit;ifLength(Trim(UserNameEdit.Text))>0thenbegin  withMainForm.PDBEnginedo  begin  SecretName=″;  ChildSex=″;  BirthDay=″;  ChildEyeColor=″;  ChildHairColor=″;  BedTimeHour=″;  FavoriteColor=″;  FavoriteFood=″;  FavoriteActivity=″;  FavoriteAnimal=″;  end;  ShowRegistration(TrimLeft(UserNameEdit.Text));  end;end;procedureTMenuForm.AssignCursorsInImages;begin//  PickUserImage.Cursor=crPESTOHandCursor;  UserNameLabel1.Cursor=crPESTOHandCursor;  UserNameLabel2.Cursor=crPESTOHandCursor;  UserNameLabel3.Cursor=crPESTOHandCursor;  UserNameLabel4.Cursor=crPESTOHandCursor;  UserNameLabel5.Cursor=crPESTOHandCursor;  UserNameLabel6.Cursor=crPESTOHandCursor;  UserNameLabel7.Cursor=crPESTOHandCursor;  UserNameLabel8.Cursor=crPESTOHandCursor;  UserNameEdit.Cursor=crPESTOHandCursor;  OKButtonImage.Cursor=crPESTOHandCursor;end;procedureTMenuForm.ImageFrame1MouseMove(SenderTObject;ShiftTShiftState;X,YInteger);begin  ifCurrentButton<>′SetUp′then  begin  ResetCurrentButton;  SetupImage.Visible=True;  CurrentButton=′SetUp′;end;end;procedureTMenuForm.ImeFrame2MouseMove(SenderTObject;ShiftTShiftState;X,YInteger);begin  ifCurrentButton<>′Animation′then  begin  ResetCurrentButton;  AnimationImage.Visible=True;  CurrentButton=′Animation′;  end;end;procedureTMenuForm.ImageFrame3MouseMove(SenderTObject;ShiftTShiftState;X,YInteger);begin  ifCurrentButton<>′Intro′then  begin  ResetCurrentButton;  IntroImage.Visible=True;  CurrentButton=′Intro′;  end;end;procedureTMenuForm.ImageFrame4MouseMove(SenderTObject;ShiftTShiftState;X,YInteger);begin  ifCurrentButton<>′Play′then  begin  ResetCurrentButton;  PlayImage.Visible=True;  CurrentButton=′Play′;  end;end;procedureTMenuForm.ImageFrame5MouseMove(SenderTObject;ShiftTShiftState;X,YInteger);begin  ifCurrentButton<>′Check′then  begin  ResetCurrentButton;  CheckImage.Visible=True;CurrentButton=′Check′;  end;end;procedureTMenuForm.ImageFrame6MouseMove(SenderTObject;ShiftTShiftState;X,YInteger);begin  ifCurrent8utton<>′Exit′then  begin  ResetCurrentButton;  ExitImage.Visible=True;  CurrentButton=′Exit′;  end;end;procedureTMenuForm.ImageFrame1Click(SenderTObject);begin  ifMainForm.ThreadInProgressthenexit;  //LoadFromDataBase  MainForm.PDBEngine.SetChildNumber(1);  UserNameLabel2.Caption=MainForm.PDBEngine.ChildName;  MainForm.PDBEngine.SetChildNumber(2);  UserNameLabel3.Caption=MainForm,PDBEngine.ChildName;  MainForm.PDBEngine.SetChildNumber(3);  UserNameLabel4,Caption=MainForm.PDBEngine.ChildName;  MainForm.PDBEngine,SetChildNumber(4);  UserNameLabel5.Caption=MainForm,PDBEngine.ChildName;  MainForm,PDBEngine.SetChildNumber(5);  UserNameLabel6.Caption=MainForm.PDBEngine.ChildName;  MainForm.PDBEngine.SetChillier(6);  UserNameLabel7.Caption=MainForm.PDBEngine.ChildName;  MainForm.PDBEngine.SetchildNumer(7);  UserNameLabel8.Caption=MainForm.PDBEngine.ChildName;  //Registration  SetupImage.Visible=False;  SetupOrgImage.Visible=True;  PickUserTitleLabel.Visible=True;  PickUserImage.Visible=True;  UserNameLabel1.Visible=True;  UserNameLabel2.Visible=True;  UserNameLabel3.Visible=True;  UserNameLatel4.Visible=True;  UserNameLatel5.Visible=True;UserNameLabel6.Visible=True;  UserNameLabel7.Visible=True;  UserNameLabel8.Visible=True;  ifUserNameLabel2.Caption=″thenUserNameLabel2.Visible=False;  ifUserNameLabel3.Caption=″thenUserNameLabel3.Visible=False;  ifUserNameLabel4.Caption=″thenUserNameLabel4.Visible=False;  ifUserNameLabel5.Caption=″thenUserNameLabel5.Visible=False;  ifUserNameLabel6.Caption=″thenUserNameLabel6.Visible=False;  ifUserNameLabel7.Caption=″thenUserNameLabel7.Visible=False;  ifUserNameLabel8.Caption=″thenUserNameLabel8.Visible=False;  ImageFrame1.Enabled=False;  ImageFrame2.Enabled=False;  ImageFrame3.Enabled=False;  ImageFrame4.Enabled=False;  ImageFrame5.Enabled=False;  ImageFrame6.Enabled=False;//ToyToTV  ToyAnimate.Visible=FaLse;  ToyImage.Visible=False;  withTVAnimatedo  begin  Active=False;  FileName=MainForm.GraphicsPath+′TV.AVT′;  Active=True;  Left=627;  Top=308;  Width=101;  height=104;  end;//  MainForm.BackGroundTalking(MainForm.AboutYouPath+′vo0041.wav′,′S′);end;procedureTMenuForm.ImageFrame2Click(SenderTObject);begin//SingAlong{Hide;CreatorForm.Show;CreatorFom.PlayMovie;}SingAlongForm.PlaySongs;{withSingALongFormdobegin  Spacel.Enabled=True;  PlaySongs;  Show;  end;}end;procedureTMenuForm.ImageFrame3Click(SenderTObject);begin  //ExecuteINTRO  MainForm.Hide;  Hide;  StatusForm.Caption=′StorytellerHow-to-PlayStatus′;  StatusForm.Show;  ifMainForm.PDBEngine.ToyNumber<0then  begin  SimulationForm.Show;  MotionSimulationForm.Show;  end;  Threadl=TIntro.Create(′Intro′);end;procedureTMenuForm.ImageFrame4Click(SenderTObject);begin//ExecutePLAY  MainForm.Hide;  Hide;  StatusForm.Caption=′StorytellerPlayStatus′;  StatusForm.Show;  ifMainForm.PDBEngine.ToyNumber<0then  begin  SimulationForm.Show;  MotionSimulationForm.Show;  end;  Threadl=TIntro.Create(′Play′);end;procedureTMenuForm.ImageFrameSClick(SenderTObject);begin//Hide;CheckUpForm.ActivateTheAnimation(True);CheckUpForm.Show;end;procedureTMenuForm.ImageFrame6Click(SenderTObjecct);begin//ExitClose;MainForm.Close;end;procedureTMenuForm.MenuImageMouseMove(SenderTObject;ShiftTShiftState;X,YInteger);beginCurrentButton=″;SetupImage.Visible=False;AnimationImage.Visible=False;IntroImage.Visible=False;PlayImage.Visible=False;CheckImage.Visible=False;ExitImage.Visible=False;end;procedureTMenuForm.ShowRegistration(Valuestring);beginwithRegistrationFormdobegin  CurrentItem=″;  SecretName=″;  Gender=″;  DateOfBirth=″;  EyeColor=″;  HairColor=″;  BedTimeHour=″;  FavoriteColor=″;  FavoriteFood=″;  FavoriteActivity=″;  FavoriteAnimal=″;  BoyImage.Visible=False;  BoyHairYellowImage.Visible=False;  BoyHairBlackImage.Visible=False;  BoyHairOrangeImage.Visible=False;  BoyHairBrownImage.Visible=False;  BoyEyeBlueImage.Visible=False;BoyEyeGreenImage.Visible=False;  BoyEyeBrownImage.Visible=False;  BoyEyeBlackImage.Visible=False;  BoyShirtYellowImage.Visible=False;  BoyShirtBlueImage.Visible=False;  BoyShirtRedImage.Visible=False;  GirlImage.Visible=False;  GirlHairYellowImage.Visible=False;  GirlHairBrownImage.Visible=False;  GirlHairOrangeImage.Visible=False;  GirlHairBlackImage.Visible=False;  GirlEyeBlueImae.Visible=False;  GirlEyeGreenImage.Visible=False;  GirlEyeBrownImage.Visible=False;  GirlEyeBlackImage.Visible=False;  GirlShirtYellowImage.Visible=False;  GirlShirtBlueImage.Visible=False;  GirlShirtRedImage.Visible=False;  FavoritePanel.Visible=False;  BirthDayPanel.Visible=False;  BedTimeHourPanel.Visible=False;end;  RegistrationForm.UserNameLabel.Caption=Value;  MainForm.PDBEngine.ChildName=Value;  MainForm.PDBEngine.UpDateCurrentChild;  RegistrationForm.LoadFromDataBase;//withRegistrationFormdobeginifSecretName=″then  begin  AboutYouLabel.Visible=False;  AboutSexLabel.Visible=False;  AboutAgeLabel.Visible=False;  AboutEyeLabel.Visibie=False;  AboutHairLabel.Visible=False;  AboutBedTimeLabel.Visible=False;  FavoritesLabel.Visible=False;  FavoritesColorLabel.Visible=False;  FavoritesFoodLabel.Visible=False;  FavoritesActivityLabel.Visible=False;FavorltesAnimalLabel.Visble=False;  endelse  begin  AboutYouLabel.Visible=True;  AboutSexLabel.Visible=True;  AboutAgeLabel.Visible=True;  AboutEyeLabel.Visible=True;  AboutHairLabel.Visible=True;  AboutBedTimeLabel.Visible=True;  FavoritesLabel.Visible=True;  FavoritesColorLabel.Visible=True;  FavoritesFoodLabel.Visible=True;  FavoritesActivityLabel.Visible=True;  FavoritesAnimalLabel.Visible=True;  DrawBoyOrGirl;  end;end;//MainForm.PDBEngine.SetCurrentToFirst;//  MainForm.Hide;  Hide;  RegistrationForm.Show;  RegistrationForm.ShowVTfSelected;MainForm.BackGroundTalking(MainForm.AboutYouPath+′vo0047.wav′,′S′);end;procedureTMenuForm.EnterlClick(SenderTObject);begin//Enter=OKifOKButtonImage.VisiblethenOKButtonImageClick(nil);end;procedureTMenuForm.EscapelClick(SenderTObject);begin//ExitClose;MainForm.Close;end;procedureTMenuForm.FormClose(SenderTObject;varActionTCloseAction);begin  TVAnimate.Active=False;end;end.================================  Copyright(c)1995-1998CreatorLtd.AllRightsReserved================================DescriptionThisisthePanelControlsunit.unitPanelControls;interfaceuses  Windows,Messages,SysUtils,Classes,Graphics,Controls,F(xiàn)orms,Dialogs,  Buttons,ExtCtrls;type  TPanelControlForm=class(TForm)  PanellTPanel;  PauseButtonTSpeedButton;  StartButtonTSpeedButton;  StopButtonTSpeedButton;  procedureStopButtonClick(SenderTObject);  procedureStartButtonClick(SenderTObject);  procedutePauseButtonClick(SenderTObject);  procedureFormCreate(SenderTObject);  procedureFormHide(SenderTObject);private  (Privatedeclarations)public  (Publicdeclarations)  Statusstring;end;varPanelControlFormTPanelControlForm;implmeentation{SR*.DFM}procedureTPanelControlForm.StopButtonClick(SenderTObject);beginStatus=′STOP′;end;procedureTPanelControlForm.StartButtonClick(SenderTObject);beginStatus=′START′;end;procedureTPanelControlForm.PauseButtonClick(SenderTObject);beginStatus=′PAUSE′;end;procedureTPanelControlForm.FormCreate(SenderTObject);beginStatus=″;end;procedureTPanelControlForm.FormHide(SenderTObject);beginStatus=″;end;end.================================  Copyright(c)1995-1998CreatorLtd.AllRightsReserved================================DescriptionThisisthePDBEngineunit.unitPDBEngine;//PseudoDataBaseEngineinterfaceusesClasses,Windows,SysUtils;typeTPDBEngine=class(TComponent)private//Registration  FChildNamestring;  FChildSexstring;  FChiidEyeColorstring;  FChildHairColorstring;  FBedTimeHourstring;  FBirthDaystring;  FSecretNamestring;  FFavoriteColorstring;  FFavoriteFoodstring;  FFavoriteActivitystring;  FFavoriteAnimalstring;  FChildNumberInteger;  FVisitSongMenuInteger;  FVisitGameMenuInteger;  FVisitStoryMenuInteger;  FVisitBunnyShortInteger;  FVisitBunnyLongInteger;  FVisitPrincessInteger;  FBunnyFavoriteFoodstring;//Configuration  FToyNumberInteger;  FDataBasePathstring;//MultiToys  FMultiToy1Integer;  FMultiToy2Integer;  FMultiToy3Integer;FMultiToy4Integer;  FMultiToy5Integer;  FMultiToy6Integer;  FMultiToy7Integer;  FMultiToy8Integer;protected//Data[ChildNumber,F(xiàn)ieldNumber]  DataArray[1..10,1..40]ofstring;//changeconst;ExampleData[i,j]=′test′;  procedureClearDataArray;public  procedureLoadRegistration;  procedureSaveRegistration;  procedureInsertNewChild;//BecomeFirstintheList(Array)  procedureUpDateCurrentChild;  procedureSetChillier(ValueInteger);  procedureLoadConfiguration;  procedureSaveConfiguration;  procedureSetCurrentToFirst;  procedureLoadMultiToys;  procedureSaveMultiToys;published//Registration  propertyChildNamestringreadFChildNamewriteFChildName;  propertyChildSexstringreadFChildSexwriteFChildSex;  propertyChildEyeColorstringreadFChildEyeColorwriteFChildEyeColor;  propertyChildHairColorstringreadFChildHaircolorwriteFChildHairColor;  propertyBedTimeHourstringreadFBedTimeHourwriteFBedTimeHour;  propertyBirthDaystringreadFBirthDaywriteFBirthDay;  propertySecretNamestringreadFSecretNamewriteFSecretName;  propertyFavoriteColorstringreadFFavoriteColorwriteFFavoriteColor;  propertyFavoriteFoodstringreadFFavoriteFoodwriteFFavoriteFood;  propertyFavoriteActivitystringreadFFavoriteActivitywriteFFavoriteActivity;  propertyFavoriteAnimalstringreadFFavoriteAnimalwriteFFavoriteAnimal;propertyChildNumberIntegerreadFChildNumberwriteSetChildNumber;  propertyVisitSongMenuIntegerreadFVisitSongMenuwriteFVisitSongMenu;  propertyVisitGameMenuIntegerreadFVisitGameMenuwriteFVisitGameMenu;  propertyVisitStoryMenuIntegerreadFVisitStoryMenuwriteFVisitStoryMenu;  propertyVisitBunnyShortIntegerreadFVisitBunnyShortwriteFVisitBunnyShort;  propertyVisitBunnyLongIntegerreadFVisitBunnyLongwriteFVisitBunnyLong;  propertyVisitPrincessIntegerreadFVisitPrincesswriteFVisitPrincess;  propertyBunnyFavoriteFoodstringreadFBunnyFavoriteFoodwriteFByFavoriteFood;//Configuration  propertyToyNumberIntegerreadFToyNumberwriteFToyNumber;  propertyDataBasePathstringreadFDataBasePathwriteFDataBasePath;//MultiToys  propertyMultiToy1IntegerreadFMultiToy1writeFMultiToy1;  propertyMultiToy2IntegerreadFMultiToy2writeFMultiToy2;  propertyMultiToy3IntegerreadFMultiToy3writeFMultiToy3;  propertyMultiToy4IntegerreadFMultiToy4writeFMultiToy4;  propertyMultiToy5IntegerreadFMultiToy5writeFMultiToy5;  propertyMultiToy6IntegerreadFMultiToy6writeFMultiToy6;  propertyMultiToy7IntegerreadFMultiToy7writeFMultiToy7;  propertyMultiToy8IntegerreadFMultiToy8writeFMultiToy8;end;const  HowManyChildren=7;  ChildProperties=40;//changealseArrayimplementationprocedureTPDBEngine.LoadRegistration;var  FTextFile;  i,jinteger;beginClearDataArrav;try  AssignFile(F,DatabasePath+′Registration.CRE′);  Reset(F);  i=1;  whilenotEOF(F)do  begin  forj=1toChildPropertiesdoReadln(F,Data{i,j});  i=i+1;  end;  CloseFile(F);except  SaveRegistration;  end;  ChildNumber=1;end;procedureTPDBEngine.SaveRegistration;var  FTextFile;  i,jInteger;beginAssignFile(F,DatabasePath+′Registration.CRE′);Rewrite(F);fori=1toHowManyChildrendo  begin  forj=1toChildPropertiesdoWriteln(F,Data{i,j});  end;CloseFile(F);end;//AllTheDataShift1stepNineBecomeTen,EihtBecomeNine....//FirstBecomeSecond.//TheNewDatawillbeintheFirstRecord.procedureTPDBEngine.InsertNewChild;varindexinteger;iinteger;jinteger;beginfori=(HowManyChildren-1)downto1dobegin  forj=1toChildPropertiesdo  beginData{i+l,j}=Data{i,j};  end;  end;//index=ChildNumber;  ChildNumber=1;  UpDateCurrentChild;//Chillier=index;end;procedureTPDBEngine.UpDateCurrentChild;beginData[ChildNumber,1]=ChildName;Data[ChildNumber,2]=Childsex;Data[ChildNumber,3]=ChildEyecolor;Data[ChildNumber,4]=ChildHairColor;Data[ChildNumber,5]=BedTimeHour;Data[ChildNumber,6]=BirthDay;Dara[ChildNumber,7]=SecretName;Data[ChildNumber,8]=FavoriteColor;Data[ChildNumber,9]=FavoriteFood;Data[Childnmber,10]=FavoriteActivity;Data[ChildNumber,11]=FavoriteAnimal;Data[ChildNumber,12]=IntToStr(VisitSongMenu);Data[ChildNumber,13]=IntToStr(VisitStoryMenu);Data[ChildNumber,14]=IntToStr(VisitBunnyShort);Data[ChildNumber,15]=IntToStr(VisitBunnyLong);Data[ChildNumber,16]=IntToStr(VisitGameMenu);Data[ChildNumber,17]=IntToStr(VisitPrincess);Data[ChildNumber,18]=BunnyFavoriteFood;SaveRegistration;end;procedureTPDBEngine.SetchildNumber(ValueInteger);begin  if(Value>0)and(Value<HowManyChildren+1)thenFchildNvmber=Value  elseFChildNumber=1;  ChildName=Data[childNumber,1];  ChildSex=Data[ChildNumber,2];  ChildEyeColor=Data[ChildNumber,3];  ChildHairColor=Data[ChildNumber,4];  BedTimeHour=Data[ChildNumber,5];  BirthDay=Data[ChildNumber,6];  SecretName=Data[ChildNumber,7];FavoriteColor=Data[ChildNumber,8];  FavoriteFood=Data[ChildNumber,9];  FavoriteActivity=Data[ChildNumber,10];  FavoriteAnimal=Data[ChildNumber,11];  VisitSongMenu=StrToIntDef(Data[ChildNumber,12],0);  VisitStoryMenu=StrToIntDef(Data[ChildNumber,13],0);  VisitBunnyShort=StrToIntDef(Data[ChildNumber,14],0);  VisitBunnyLong=StrToIntDef(Data[ChildNumber,15],0);  VisitGameMenu=StrToIntDef(Data[ChildNumber,16],0);  VisitPrincess=StrToIntDef(Data[ChildNumber,17],0);  BunnyFavoriteFood=Data[ChildNumber,18];end;procedureTPDBEngine.ClearDataArray;variinteger;jinteger;begin  fori=1toHowManyChildrendo  begin  forj=1toChildPropertiesdo  begin  Data[i,j]=′′;  end;  end;end;procedureTPDBEngine.LoadConfiguration;varFTextFile;beginFToyNumber=0;try  AssignFile(F,DatabasePath+′Configuration.CRE′);  Reset(F);  Readln(F,F(xiàn)ToyNumber);  CloseFile(F);except  SaveConfiguration;end;end;procedureTPDBEngine.SaveConfiguration;varFTextFile;beginAssignFile(F,DatabasePath+′Configuration.CRE′);Rewrite(F);  Writeln(F,F(xiàn)ToyNumber);CloseFile(F);end;procedureTPDBEngine.SetCurrentToFirst;variinteger;Tempstring;begin//  WhileChildNumber>1do  begin  fori=1toChildPropertiesdo  begin  Temp=Data[Chillier,i];  Data[ChildNumber,i]=Data[ChildNumber-1,i];  Data[ChildNumber-1,i]=Temp;  end;  Chillier=ChildNumber-1;  end;end;procedureTPDBEgine.LoadMultiToys;varFTextFile;beginEToyNumber=0;tryAssignFile(F,DatabasePath+′MultiToys.CRE′);Reset(F);Readln(F,F(xiàn)MultiToy1);Readln(F,F(xiàn)MultiToy2);Readln(F,F(xiàn)MultiToy3);Readln(F,F(xiàn)MultiToy4);Readln(F,F(xiàn)MultiToy5);Readln(F,F(xiàn)MultiToy6);Readln(F,F(xiàn)MultiToy7);Readln(F,F(xiàn)MultiToy8);CloseFile(F);except  SaveConfiguration;  end;end;procedureTPDBEngine.SaveMultiToys;varFTextFile;beginAssignFile(F,DatabasePath+′MultiToys.CRE′);Rewrite(F);Writeln(F,F(xiàn)MultiToy1);Writeln(F,F(xiàn)MultiToy2);Writeln(F,F(xiàn)MultiToy3);Writeln(F,F(xiàn)MultiToy4);Writeln(F,F(xiàn)MultiToy5);Writeln(F,F(xiàn)MultiToy6);Writeln(F,F(xiàn)MultiToy7);Writeln(F,F(xiàn)MultiToy8);CloseFile(F);end;end.================================  Copyright(c)1995-1998CreatorLtd.AllRightsReserved================================Description;ThisisthePestoSongunit.unitPestoSong;interfaoeusesWindows,Messages,SysUtils,Classes,Graphics,Controls,F(xiàn)orms,Dialogs,Menus,ExtCtrls,MPlayer;typeTPestoSongForm=class(TForm)  MainMenulTMainMenu;  testlTMenuItem;  spacelTMenuItem;  MediaPlayerlTMediaPlayer;  PanellTPanel;  TimerlTTimer;  EscapelTMenuItem;  procedurespacelClick(SenderTObject);  procedureFormCreate(SenderTObject);  procedureTimerlTimer(SenderTObject);  procedureEscapelClick(SenderTObject);  procedureFormClose(SenderTObject;varActionTCloseAction);private  (Privatedeclarations)public  (Publicdeclarations)  FirstTimePlayBoolean;  SectionInteger;  procedurePlayMovie;  procedureGoToMenu;  procedureplaySection(valueInteger);  procedureToyTalk(NumbersOfToystring;Wavestring;motionstring);end;var  PestoSongFormTPestoSongForm;implementationusesMainMenu;(SR*.DFM)procedureTPestoSongForm.spacelClick(SenderTObject);begin//space  ifMainForm.ThreadInProgress=Truethenexit;GoToMenu;end;procedureTPestoSongForm.GoToMenu;begin  Timerl.Enabled=False;  Spacel.Enabled=False;  MediaPlayerl.Stop;  MediaPlayerl.Close;  hide;  MenuForm.Show;end;procedureTPestoSongForm.PlayMovie;begin  MediaPlayerl.Play;  ToyTalk(′All′,′StoryTeller.wav′,′S′);end;procedureTPestoSongForm.PlaySection(ValueInteger);begin  MediaPlayerl.close;  caseValueof  1begin  MediaPlayerl.FileName=MainForm.GraphicsPath+′Logo.avi′;  ToyTalk(′one′,′Logo.wav′,′S′);  end;  2begin  MediaPlayerl.FileName=MainForm.GraphicsPath+′Alonel.mov′;  ToyTalk(′One′,′Alonel.wav′,′S′);  end;3begin  MediaPlayerl.FileName=MainForm.GraphicsPath+′Alone2.mov′;  ToyTalk(′One′,′Alone2.wav′,′S′);  end;  4begin  MediaPlayerl.FileName=MainForm.GraphicsPath+′Alone3.mov′;  ToyTalk(′One′,′Alone3.wav′,′S′);  end;  5begin  MediaPlayerl.FileName=MainForm.GraphicsPath+′All.mov′;  ToyTalk(′All′,′All.wav′,′S′);  end;  end;  MediaPlayerl.open;  MediaPlayerl.Play;end;procedureTPestoSongForm.FormCreate(SenderTObject);begin  Panell.Cursor=crNone;  Timerl.Enabled=False;  Timerl.Interval=60000;  Cursor=crNone;  MediaPlayerl.FileMame=MainForm.GraphicsPath+′StoryTeller.avi′;  MediaPlayerl.open;  FirstTimePlay=True;end;procedureTPestoSongForm.TimerlTimer(SenderTObject);begin//GoToMenu;end;procedureTPestoSongForm.EscapelClick(SenderTObject);begin//ExitifMainForm.ThreadInProgress=Truethenexit;MediaPlayerl.stop;MediaPlayerl.Close;  Hide;  MenuForm.Show;end;procedureTPestoSongForm.ToyTalk(NumbersOfToystring;Wavestring;motionstring);varToyNoInteger;beginifNumbersOfToy=′All′thenToyNo=85//55H  elseToyNo=MainForm.Toy.ToyNumber;  MainForm.TalkInBackGround(ToyNo,MainForm.AudioPath+Wave,′′);end;procedureTPestoSongForm.FormClose(SenderTObject;varActionTCloseAction);begintryMediaPlayerl.stop;exceptend;tryMediaPlayerl.Close;exceptend;end;end.================================  Copyrignt(c)1995-1998CreatorLtd.AllRightsReserved================================Description;ThisistheRegistrationunit.unitRegistration;interfaceusesWindows,Messages,SysUtils,Classes,Graphics,Controls,F(xiàn)orms,Dialogs,ExtCtrls,jpeg,StdCtrls,Buttons,Spin,Grids,Calendar,ComCtrls,Menus;typeTRegistrationForm=class(TForm)  RegistrationImageTImage;  RegistrationBackImageTImage;  UserNameLabelTLabel;  BoyImageTImage;  BoyHairYellowImageTImage;  BoyHairBlackImageTImage;  BoyHairOrangeImageTImage;  BoyHairBrownImageTImage;  BoyEyeBlueImageTImage;  BoyEyeGreenImageTImage;  BoyEyeBrownImageTImage;  BoyEyeBlackImageTImage;  BoyShirtYellowImageTImage;  BoyShirtBlueImageTImage;  BoyShirtRedImageTImage;  GirlImageTImage;  GirlHairYellowImageTImage;  GirlHairBrownImageTImage;  GirlHairOrangeImageTImage;  GirlHairBlackImageTImage;  GirlEyeBlueImageTImage;  GirlEyeGreenImageTImage;  GirlEyeBrownImageTImage;  GirlEyeBlackImageTImage;  GirlShirtYellowImageTImage;  GirlShirtBlueImageTImage;  GirlShirtRedImageTImage;AboutYouLabelTLabel;AboutSexLabelTLabel;AboutAgeLabelTLabel;AboutEyeLabelTLabel;AboutHairLabelTLabel;AboutBedTimeLabelTLabel;FavoritesLabelTLabel;FavoritesColorLabelTLabel;FavoritesFoodLabelTLabel;FavoritesActivityLabelTLabel;FavoritesAnimalLabelTLabel;FavoritePanelTPanel;PanelImageTImage;PanelLabel1TLabel;PanelLabel2TLabel;PanelLabel3TLabel;PanelLabel4TLabel;SecretNameLabelTLabel;GoOutArrowImageTImage;BirthDayPanelTPanel;BirthDayImageTImage;CalendarlTCalendar;SpinEditlTSpinEdit;ComboBoxlTComboBox;BedTimeHourPanelTPanel;BedTimeHourImageTImage;ComboBox2TComboBox;BearEyesAnimateTAnimate;SteemAnimateTAnimate;WheelsAnimateTAnimate;BirthDayOKImageTImage;BedTimeHourOKImageTImage;VGenderImageTImage;VBirthdayImageTImage;VEyeColorImageTImage;VHairColorImageTImage;VBedTimeHourImageTImage;VFavoriteColorImageTImage;VFavoriteFoodImageTImage;VFavoriteActivityImageTImage;VFavoriteAnimalImageTImage;MainMenulTMainMenu;testlTMenuItem;EscapelTMenuItem;BallJumpAnimateTAnimate;procedureFormCreate(SenderTObject);procedureRegietrationBackImageClick(SenderTObject);procedureAboutSexLabelClick(SenderTObject);procedureAboutAgeLabelClick(SenderTObject);procedureAboutEyeLabelClick(SenderTObject);procedureAboutHairLabelClick(SenderTObject);procedureAboutBedTimeLabelClick(SenderTObject);procedurePanelLabel1Click(SenderTObject);procedurePanelLabel2Click(SenderTObject);procedurePanelLabel3Click(SenderTObject);procedurePanelLabel4Click(SenderTObject);procedureFavoritesColorLabelClick(SenderTObject);procedureFavoritesFoodLabelClick(SenderTObject);procedureFayoritesActivityLabelClick(SenderTObject);procedureFavoritesAnimalLabelClick(SenderTObject);procedureAboutSexLabelMouseMove(SenderTObject;shiftTShiftState;X,YInteger);procedureAboutAgeLabelMouseMove(SenderTObject;ShiftTShiftState;X,YInteger);procedureAboutEyeLabelMouseMove(SenderTObject;ShiftTShiftState;X,YInteger);procedureAboutHairLabelMouseMove(SenderTObject;ShiftTShiftState;X,YInteger);procedureAboutBedTimeLabelMouseMove(SenderTObject;ShiftTShiftState;X,YInteger);procedurePanelLabel1MouseMove(SenderTObject;ShiftTShiftState;X,YInteger);procedurePanelLabel2MouseMove(SenderTObject;ShiftTShiftState;X,YInteger);procedurePanelLabel3MouseMove(SenderTObject;ShiftTShiftState;X,YInteger);procedurePanelLabel4MouseMove(SenderTObject;ShiftTShiftState;X,YInteger);procedureFavoritesColorLabelMouseMove(SenderTObject;ShiftTShiftState;X,YInteger);procedureFavoritesFoodLabelMouseMove(SenderTObject;ShiftTShiftState;X,YInreger);procedureFavoritesActivityLabelMouseMove(SenderTObject;ShiftTShiftState;X,YInteger);procedureFavoritesAnimalLabelMouseMove(SenderTObject;ShiftTShiftState;X,YInteger);]]></pre>procedureRegiscrationImageMouseMove(SenderTObjecc;ShiftTShiftState;X,YInteger);DrocedureSecretNameLabelMouseMove(SenderTObject;ShiftTShiftState,X,YInteger);procedureRegistrationBackImageMouseMove(SenderTObject;ShiftTShiftState;X,YInteger);procedureGoOutArrowImageclick(SenderTObject);procedureComboBoxlchange(SenderTObject);procedureSpinEditlchange(SenderTObject);procedureCalendarlchange(SenderTObject);procedureBirthDaFImageClick(SenderTObject);procedureRegistrationImageclick(SenderTObject);procedureBedTimeHourImageclick(SenderTObject);procedureComboBox2Change(SenderTObject);procedureBirthDayOKImageClick(SenderTObject),procedureBedTimeHourOKImageclick(SenderTObject);procedureEscapelClick(SenderTObject);private(Privatedeclarations)public(Publicdeclarations)CurrentItemstring,ChildNamestring;SecretNamestring;Genderstring;DateofBirthstring;EyeCoIorstring;HairColorstring;BedTimeHourstring,F(xiàn)avoriteColOrstring;FavoriteFoodstring;FavoriteActivitystring;FavoriteAnimalstring;procedureInitialReg;procedureDrawBoyorGirl;procedureAssignCurrentItem(Valuestring);procedureGoBackToMenu;proccdureChoosePanelLabel(ValueInteger);procedureSaveToDataBase;procedureLoadFromDataBase;ProcedureBackgroungSpeaking(Valuestring);procedureShowVTfSelected;<prelisting-type="program-listing"xml:space="preserve"><![CDATA[end;var  RegistrationFormTRegistrationForm;implementationusesMain,Menu;(SR*.DFM)procedureTRegistrationForm.FormCreate(SenderTObject);begin//MaximizeWindowState=wsMaximized;RegistrationBackImage.Cursor=crDefault;InitialReg;end;procedureTRegistrationForm.RegistrationBackImageClick(SenderTObject);begin//ifMainForm.ThreadInFrogressthenexit;GoBackToMenu;end;procedureTregistrationForm.GoBackToMenu;beginwithMenuFormdobegin  PickUserImage.Visible=alse;  //Reg1  PickUserTitleLabel.Visible=False;  UserNameLabel1.Visible=False;  UserNameLabel2.Visible=False;  UserNameLabel3.Visible=False;  UserNameLabel4.Visible=False;  UserNameLabel5.Visible=False;  UserNameLabel6.Visible=False;  UserNameLabel7.Visible=False;  UserNameLabel8.Visible=False;  //Reg2  PickUserLabel1.Visible=False;UserNameEdit.Visible=False;  OKButtonImage.Visible=False;  SetUpOrgImage.Visible=False;  SetupImage.Visible=True;  ImageFrame1.Enabled=True;  ImageFrame2.Enabled=True;  ImageFrame3.Enabled=True;  ImageFrame4.Enabled=True;  ImageFrame5.Enabled=True;  ImageFrame6.Enabled=True;//ToyToTV  ToyAnimate.Visible=True;  ToyImage.Visible=True;  withTVAnimatedo  begin  Active=False;  FileName=MainFom.GraphicsPath+′noise.AVI′;  Active=True;  Left=629;  Top=318;  Width=112;  height=88;  end;//  end;SaveToDataBase;Close;MenuForm.Show;end;procedureTRegistrationForm.InitialReg;begin  RegistrationImage.Visible=True;  RegistrationBackImage.Visible=True;  UserNameLabel.Visible=True;  BoyImage.Visible=False;  BoyHairYellowImage.Visible=False;  BoyHairBlackImage.Visible=False;  BoyHairOrangeImage.Visible=False;  BoyHairBrownImage.Visible=False;BoyEyeBlueImage.Visible=Falsc;BoyEyeGreenImage.Visible=False;BoyEyeBrownImage.Visible=False;BoyEyeBlackImage.Visible=False;BoyShirtYellowImage.Visible=False;BoyShirtBlueImage.Visible=False;BoyShirtRedImage.Visible=False;GirlImage.Visible=False;GirlHairYellowImage.Visible=False;GirlHairBrownImage.Visible=False;GirlHairOrangeImage.Visible=False;GirlHairBlackImage.Visible=False;GirlEyeBlueImage.Visible=False;GirlEyeGreenImage.Visible=False;GirlEyeBrownImage.Visible=False;GirlEyeBlackImage.Visible=False;GirlShirtYellowImage.Visible=False;GirlShirtBlueImage.Visible=False;GirlShirtRedImage.Visible=False;AboutYouLabel.Visible=False;AboutSexLabel.Visible=False;AboutAgeLabel.Visible=False;AboutEyeLabel.Visible=False;AboutHairLabel.Visible=False;AboutBedTimeLabel.Visible=False;FavoritesLabel.Visible=FalseFavoritesColorLabel.Visible=False;FavoritesFoodLabel.Visible=False;FavoritesActivityLabel.Visible=False;FavoritesAnimalLabel.Visible=False;FavoritePanel.Visible=False;//RegistrationImage.Cursor=6;AboutSexLabel.Cursor=5;AboutAgeLabel.Cursor=5;AboutEyeLabel.Cursor=5;AboutHairLabel.Cursor=5;AboutBedTimeLabel.Cursor=5;FavoritesColorLabel.Cursor=5;FavoritesFoodLabel.Cursor=5;EavorltesActlvltyLaDel.Cursot=5;  FavoritesAnimalLabel.Cursor=5;  PanelImage.Cursor=5;  PanelLabel1.Cursor=5;  PanelLabel2.Cursor=5;  PanelLabel3.Cursor=5;  PanelLabel4.Cursor=5;  SecretNameLabel.Cursor=5;  RegistrationBackImage.Cursor=5;  GoOutArrowImage.Cursor=5;  BedTimeHourOKImage.Cursor=5;  BirthDayOKImage.Cursor=5;  CurrentItem=″;  SecretName=″;  Gender=″;  DateOfBirth=″;  EyeColor=″;  HairColor=″;  BedTimeHour=″;  FavoriteColor=″;  FavoriteFood=″;  FavoriteActivity=″;  FavoriteAnimal=″;ComboBox1.Items.Add(′January′);ComboBox1.Items.Add(′February′);ComboBox1.Items.Add(′March′);ComboBox1.Items.Add(′April′);ComboBox1.Items.Add(′May′);ComboBox1.Items.Add(′June′);ComboBox1.Items.Add(′July′);ComboBox1.Items.Add(′August′);ComboBox1.Items.Add(′September′);ComboBox1.Items.Add(′October′);ComboBox1.Items.Add(′November′);ComboBox1.Items.Add(′December′);SpinEditl.Value=1995;ComboBox2.Items.Add(′600PM′);ComboBox2.Items.Add(′630PM′);ComboBox2.Items.Add(′700PM′);ComboBox2.Items.Add(′730PM′);ComboBox2.Items.Add(′900PM′);  ComboBox2.Items.Add(′930PM′);  ComboBox2.Items.Add(′900PM′);  ComboBox2.Items.Add(′930PM′);  ComboBox2.Items.Add(′1000PM′);  ComboBox2.Items.Add(′1030PM′);  withBedTimeHourPaneldo  begin  Left=135;  Top=335;  Width=157;  Height=78;withBirthDayPaneldo  begin  Left=134;  Top=239;  Width=278;  Height=201;  end;  end;  BearEyesAnimate.FileName=MainForm.GraphicsPath+′BearEye.avi′;  SteemAnimate.FileName=MainForm.GraphicsPath+′Steem.avi′;  WheelsAnimate.FileName=MainForm.GraphicsPath+′Wheels.avi′;  BallJumpAnimate.FileName=MainForm.GraphicsPath+′BallJump.avi′;  BearEyesAnimate.Active=True;  SteePte.Active=True;  WheelsAnimate.Active=True;  BallJumpAnimate.Active=True;end;procedureTRegistrationForm.AboutSexLabelClick(SenderTObject);begin//  ifMainForm.ThreadInProgressthenexit;  ifGender=′Boy′thenChoosePanelLabel(1);  ifGender=′Girl′thenChoosePanelLabel(2);  PanelLabel1.caption=′Boy′;  PanelLabel2.caption=′Girl′;  withFavoritePaneldobegin  Left=134;  Top=204;  Width=225;  Height=65;  end;  FavoritePanel.Visible*True;  BedTimeHourPanel.Visible=False;  BirthDayPanel.Visible=False;  CurrentItem=′Gender′;  SteemAnimate.Visible=True;  MainForm.BackGroundTalking(MainForm.AboutYouPath+′ay62.wav′,′S′);end;procedureTRegistrationForm.AboutAgeLabelClick(SenderTObject);var  Tempstring;begin  ifMainForm.ThreadInProgressthenexit;  Temp=DateOfBirth;  ifLength(DateOfBirth)=10then  begin  Calendarl.Year=StrToInt(copy(Temp,7,4));  Calendarl.Day=StrToInt(copy(Temp,4,2));  Calendarl.Month=StrToInt(copy(Temp,1,2));  end;  SpinEditl.Value=Calendarl.Year;  ComboBox1.ItemIndex=Calendarl.Month-l;  BirthDayPanel.Visible=True;  Favoritepanel.Visible=False;  BedTimeHourPanel.Visible=False;  SteemAnimate.Visible=False;  MainForm.BackGroundTalking(MainForm.AboutYouPath+′ay63.wav′,′S′);end;procedureTRegistrationForm.AboutEyeLabelClick(SenderTObject);begin//  ifMainForm.ThreadInProgressthenexit;  ifEyeColor=′Blue′thenChoosePanelLabel(1);  ifEyeColor=′Green′thenChoosePanelLabel(2);  ifEyeColor=′Brown′thenChoosePanelLabel(3);  ifEyeColor=′Black′thenChoosePanelLabel(4);PanelLabel1.caption=′Blue′;  PanelLabel2.caption=′Green′;  PanelLabel3.caption=′Brown′;  PanelLabel4.caption=′Black′;  withFavoritePaneldo  begin  Left=134;  Top=269;  Width=225;  Height=145;  end;  FavoritePanel.Visible=True;  BedTimeHourPanel.Visible=False;  BirthDayPanel.Visible=False;  CurrentItem=′EyeColor′;  SteemAnimate.Visible=False;  MainForm.BackGroundTalking(MainForm.AboutYouPath+′ay66.wav′,′S′);end;procedureTRegistrationForm.AboutHairLabelClick(SenderTObject);begin//  ifMainForm.ThreadInProgressthenexit;  ifHairColor=′Blond′thenChoosePanelLabel(1);  ifHairColor=′Brown′thenChoosePanelLabel(2);  ifHairColor=′Red′thenChoosePanelLabel(3);  ifHairColor=′Black′thenChoosePanelLabel(4);  PanelLabel1.caption=′Blond′;  PanelLabel2.caption=′Brown′;  PanelLabel3.caption=′Red′;  PanelLabel4.caption=′Black′;  withFavoritePaneldo  begin  Left=134;  Top=302;  Width=225;  Height=145;  end;  FavoritePanel.Visible=True;  BedTimeHourPanel.Visible=False;  BirthDayPanel.Visible=False;CurrentItem=′HalrColor;  SteemAnimate.Visible=False;  MainForm.BackGroundTalking(MainForm.AboutYouPath+′ay67.wav′,′S′);end;procedureTRegistrationForm.AboutBedTimeLabelClick(SenderTObject);beginifMainForm.ThreadInProgressthenexit;ComboBox2.ItemIndex=ComboBox2.Items.IndexOf(BedTimeHour);BedTimeHourPanel.Visible=True;FavoritePanel.Visible=False;BirthDayPanel.Visible=False;SteemAnimate.Visible=False;MainForm.BackGroundTalking(MainForm.AboutYouPath+′ay68.wav′,′S′);end;procedureTRegistrationForm.PanelLabellClick(SenderTObject);begin  ifMainForm.ThreadInProgressthenexit;  FavoritePanel.Visible=False;  AssignCurrentItem(PanelLabell.Caption);  DrawBoyOrGirl;  CurrentItem=′′;end;procedureTRegistrationForm.PanelLabel2Click(SenderTObject);begin  ifMainForm.ThreadInProgtessthenexit;  FavoritePanel.Visible=False;  AssignCurrentItem(PanelLabel2.Caption);  DrawBoyOrGirl;  CurrentItem=′′;end;procedureTRegistrationForm.PanelLabel3Click(SenderTObject);begin  ifMainForm.ThreadInProgressthenexit;  FavoritePanel.Visible=False;  AssignCurrentItem(PanelLabel3.Caption);  DrawBoyOrGirl;  CurrentItem=′′;end;procedureTRegistrationForm.PanelLabel4Click(SenderTObject);begin  ifMainForm.ThreadInProgressthenexit;  FavoritePanel.Visible=False;  AssignCurrentItem(PanelLabel4.Caption);  DrawBoyOrGirl;  CurrentItem=′′;end;procedureTRegistrationForm.FavoritesColorLabelClick(SenderTObject);begin//  ifMainForm.ThreadInProgressthenexit;  ifFavoriteColor=′Yellow′thenChoosePanelLabel(1);  ifFavoriteColor=′Blue′thenChoosePanelLabel(2);  ifFavoriteColor=′Red′thenChoosePanelLabel(3);  PanelLabel1.caption=′Yellow′;  PanelLabel2.caption=′Blue′;  PanelLabel3.caption=′Red′;  withFavoritePaneldo  begin  Left=415;  Top=204;  Width=225;  Height=115;  end;  FavoritePanel.Visible=True;  BedTimeHourpanel.Visible=False;  BirthDayPanel.Visible=False;  CurrentItem=′FavoriteColor′;  SteemAnimate.Visible=True;  MainForm.BackGroundTalking(MainForm.AboutYouPath+′fa71.wav′,′S′);end;procedureTRegistrationForm.FavoritesFoodLabelClick(SenderTObject);begin//ifMainForm.ThreadInProgressthenexit;ifFavoriteFood=′Pizza′thenChoosePanelLabel(1);ifFavoriteFood=′FrenchFries′thenChoosePanelLabel(2);ifFavoriteFood=′MacaroniAndCheese′thenChoosePanelLabel(3);PanelLaDel1.caption=′FrenchFries′;  PanelLabel2.caption=′FrenchFries′;  PanelLabel3.caption=′MacaroniAndCheese′;  withFavoritePaneldo  begin  Left=415;  Top=236;  Width=225;  Height=115;  end;  FavoritePanel.Visible=True;  BedTimeHourPanel.Visible=False;  BirthDayPanel.Visible=False;  CurrentItem=′FavoriteFood′;  SteemAnimate.Visible=True;  MainForm.BackGroundTalking(MainForm.AboutYouPath+′fa72.wav′,′S′);end;procedureTRegistrationForm.FavoritesActivityLabelClick(SenderTObject);begin//ifMainForm.ThreadInProgressthenexit;ifFavoriteActivity=′Drawing′thenChoosePanelLabel(1);ifFavoriteActivity=′PlayingComputerGames′thenChoosePanelLabel(2);ifFavoriteActivity=′Pretending′thenChoosePanelLabel(3);PanelLabel1.caption=′Drawing′;PanelLabel2.caption=′PlayingComputerGames′;PanelLabel3.caption=′Pretending′;withFavoritePaneldobegin  Left=415;  Top=271;  Width=225;  Height=115;  end;  FavoritePanel.Visible=True;  BedTimeHourPanel.Visible=False;  BirthDayPanel.Visible=False;  CurrentItem=′FavoriteActivity′;  SteemAnimate.Visible=True;  MainForm.BackGroundTalking(MainForm.AboutYouPath+′fa73.wav′,′S′);end;procedureTRegistrationForm.FavoritesAnimalLabelClick(SenderTObject);begin//ifMainForm.ThreadInProgressthenexit;ifFavoriteAnimal=′Horse′thenChoosePanelLabel(1);ifFavoriteAnimal=′Dog′thenChoosePanelLabel(2);ifFavoriteAnimal=′Cat′thenChoosePanelLabel(3);PanelLabel1.caption=′Horse′;PanelLabel2.caption=′Dog′;PanelLabel3.caption=′Cat′;withFavoritePaneldobegin  Left=415;  Top=304;  Width=225;  Height=115;end;FavoritePanel.Visible=True;BedTimeHourPanel.Visible=False;BirthDayPanel.Visible=False;CurrentItem=′FavoriteAnimal′;SteemAnimate.Visible=True;MainForm.BackGroundTalking(MainForm.AboutYouPath+′fa74.wav′,′S′);end;procedureTRegistrationForm.ChoosePanelLabel(ValueInteger);beginifValue=1thenPanelLabel1.Font.Color=clFuchsia;ifValue=2thenPanelLabel2.Font.Color=clFuchsia;ifValue=3thenPanelLabel3.Font.Color=clFuchsia;ifValue=4thenPanelLabel4.Font.Color=clFuchsia;end;procedureTRegistrationForm.AboutSexLabelMouseMove(SenderTObject;ShiftTShiftState;X,YInteger);beginAboutSexLabel.Font.Color=clTeal;end;procedureTRegistrationForm.AboutAgeLabelMouseMove(SenderTObject;ShiftTShiftState;X,YInteger);begin]]></pre>end;proceduraTRegistrationEorm.AboutEyeLabelMouseMove(SenderTObject;ShiftTShiftState;X,YInteger);beginAboutEyeLabel.Color=clTeal;end;procedureTRegistrationForm.AboutHairLabelMouseMove(SenderTObject;ShiftTShiftState;X,YInteger);beginAboutHairLabel.Font.Color=clTeal;end;procedureTRegistrationForm.AboutBedTimeLabelMouseMove(SenderTObject;Shift;TShiftState;X,YInteger);beginAboutBedTimeLabel.Font.Color=clTeal;end;procedureTRegistrationForm.PanelLabel1MouseMove(SenderTObject;ShiftTShiftState;X,YInteger);beginPanelLabel1.Font.Color=clRed;PanelLabel2.Font.Color=clTeal;PanelLabel3.Font.Color=clTeal;PanelLabel4.Font.Color=clTeal;end;procedureTRegistrationForm.PanelLabel2MouseMove(SenderTObject;ShiftTShiftState;X,YInteger);beginPanelLabel1.Font.Color=clTeal;PanelLabel2.Font.Color=clRed;PanelLabel3.Font.Color=clTeal;PanelLabel4.Font.Color=clTeal;end;procedureTRegistrarionForm.PanelLabel3MouseMove(SenderTObject;ShiftTShiftState;X,YInteger);beginPanelLabel1.Font.Color=clTeal;<prelisting-type="program-listing"xml:space="preserve"><![CDATA[PanelLabel2.Font.Color=clTeal;  PanelLabel3.Font.Color=clRed;  PanelLabel4.Font.Color=clTeal;end;procedureTRegistrationForm.PanelLabel4MouseMove(SenderTObject;  ShiftTShiftState;X,YInteger);begin  PanelLabel1.Font.Color=clTeal;  PanelLabel2.Font.Color=clTeal;  PanelLabel3.Font.Color=clTeal;  PanelLabel4.Font.Color=clRed;end;procedureTRegistrationForm.FavoritesColorLabelMouseMove(SenderTObject;ShiftTShiftState;X,YInteger);beginFavoritesColorLabel.Font.Color=clTeal;end;procedureTRegistrationForm.FavoritesFoodLabelMouseMove(SenderTObject;ShiftTShiftState;X,YInteger);begin  FavoritesFoodLabel.Font.Color=clTeal;end;procedureTRegistrationForm.FavoritesActivityLabelMouseMove(SenderTObject;ShiftTShiftState;X,YInteger);beginFavoritesActivityLabel.Font.Color=clTeal;end;procedureTRegistrationForm.FavoritesAnimalLabelMouseMove(SenderTObject;ShiftTShiftState;X,YInteger);beginFavoritesAnimalLabel.Font.Color=clTeal;end;procedureTRegistrationForm.SecretNameLabelClick(SenderTObject);begin//  ifMainForm.ThreadInProgressthenexit;  ifSecretName=′BubbleGum′thenChoosePanelLabel(1);ifSecretName=′RainBow′thenChoosePanelLabel(2);  PanelLabel1.caption=′BubbleGum′;  PanelLabel2.caption=′RainBow′;  withFavoritePaneldo  begin  Left=292;  Top=186;  Width=225;  Height=85;  end;  FavoritePanel.Visible=True;  BedTimeHourPanel.Visible=False;  BirthDayPanel.Visible=False;  CurrentItem=′SecretName′;  SteemAnimate.Visible=True;  MainForm.BackGroundTalking(MainForm.AboutYouPath+′fa75.wav′,′S′);end;procedureTRegistrationFom.RegistrationImageMouseMove(SenderTObject;ShiftTShiftState;X,YInteger);begin//  AboutSexLabel.Font.Color=clBlue;  AboutAgeLabel.Font.Color=clBlue;  AboutEyeLabel.Font.Color=clBlue;  AboutHairLabel.Font.Color=clBlue;  AboutBedTimeLabel.Font.Color=clBlue;  FavoritesColorLabel.Font.Color=clBlue;  FavoritesFoodLabel.Font.Color=clBlue;  FavoritesActivityLabel.Font.Color=clBlue;  FavoritesAnimalLabel.Font.Color=clBlue;  PanelLabel1.Font.Color=clTeal;  PanelLabel2.Font.Color=clTeal;  PanelLabel3.Font.Color=clTeal;  PanelLabel4.Font.Color=clTeal;  SecretNameLabel.Font.Color=clGray;  ifCurrentItem=′′thenFavoritePanel.Visible=False;  GoOutArrowImage.Visible=False;end;procedureTRegistrationForm.SecretNameLabelMouseMove(SenderTObject;ShiftTShiftState;X,YInteger);begin//  SecretNameLabel.Font.Color=clFuchsia;end;procedureTRegistrationForm.DrawBoyOrGirl;vardxinteger;dyinteger;begin//BoyHairYellowImage.Visible=False;BoyHairBlackImage.Visible=False;BoyHairOrangeImage.Visible=False;BoyHairBrownImage.Visible=False;BoyEyeBlueImage.Visible=False;BoyEyeGreenImage.Visible=False;BoyEyeBrownImage.Visible=False;BoyEyeBlackImage.Visible=False;BoyShirtYellowImage.Visible=False;BoyShirtBlueInage.Visible=False;BoyShirtRedImage.Visible=False;GirlHairYellowImage.Visible=False;GirlHairBrownImage.Visible=False;GirlHairOrangeImage.Visible=False;GirlHairBlackImage.Visible=False;GirlEyeBlueImage.Visible=False;GirlEyeGreenImage.Visible=False;GirlEyeBrownImage.Visible=False;GirlEyeBlackImage.Visible=False;GirlShirtYellowImage.Visible=False;GirlShirtBlueImage.Visible=False;GirlShirtRedImage.Visible=False;//dx=32;dy=30;ifGender=′Boy′thenbegin  GirlImage.Visible=False;  withBoyImagedo  begin  Left=272+dx;  Top=208+dy;  Width=201;  Height=337;  Visible=True;  end;  ifHairColor=′Blond′then  withBoyHairYellowImagedo  begin  Left=309+dx;  Top=208+dy;  Width=109;  Height=98;  Visible=True;  end;  ifHairColor=′Brown′then  withBoyHairBrownImagedo  begin  Left=312+dx;  Top=208+dy;  Width=105;  Height=97;  Visible=True;  end;  ifHairColor=′Red′then  withBoyHairOrangeImagedo  begin  Left=312+dx;  Top=208+dy;  Width=105;  Height=97;  Visible=True;  end;ifHairColor=′Black′thenwithBoyHairBlackImagedobegin  Left=311+dx;  Top=208+dy;  Width=113;  Height=105;  Visible=True;end;ifEyeColor=′Blue′thenwithBoyEyeBlueImagedobeginLeft=352+dx;Top=267+dy;Width=46;Height=25;Visible=True;end;ifEyeColor=′Green′thenwithBoyEyeGreenImagedobeginLeft=356+dx;Top=268+dy;Width=49;Height=25;Visible=True;end;ifEyeColor=′Brown′thenwithBoyEyeBrownImagedobeginLeft=352+dx;Top=267+dy;Width=49;Height=25;Visible=True;end;ifEyeColor=′Black′thenwithBoyEyeBlackImagedobegin  Left=352+dx;  Top=265+dy;  Width=49;  Height=24;  Visible=True;  end;  ifFavoriteColor=′Yellow′then  withBoyShirtYellowImagedo  begin  Left=288+dx;  Top=320+dy;  Width=185;  Height=193;  Visible=True;  end;  ifFavoriteColor=′Blue′then  withBoyShirtBlueImagedo  begin  Left=285+dx;  Top=319+dy;  Width=156;  Height=192;  Visible=True;  end;  ifFavoriteColor=′Red′then  withBoyShirtRedImagedo  begin  Left=285+dx;  Top=312+dy;  Width=161;  Height=185;Visible=True;  end;  end;//ifGender=′Girl′thenbegin  BoyImage.Visible=False;withGirlImagedobeginLeft=274+dx;Top=197+dy;Width=177;Height=305;Visible=True;end;ifHairColor=′Blond′thenwithGirlHairYellowImagedobeginLeft=281+dx;Top=197+dy;Width=139;Height=121;Visible=True;end;ifHairColor=′Brown′thenwithGirlHairBrownImagedobeginLeft=277+dx;Top=197+dy;Width=143;Height=129;Visible=True;end;ifHairColor=′Red′thenwithGirlHairOrangeImagedobeginLeft=279+dx;Top=197+dy;Width=142;Height=129;Visible=True;end;ifHairColor=′Black′thenwithGirlHairBlackImagedobeginLeft=280+dx;  Top=197+dy;  Width=139;  Height=129;  Visible=True;end;ifEyeColor=′Blue′thenwithGirlEyeBlueImagedobegin  Left=360+dx;  Top=266+dy;  Width=49;  Height=33;  Visible=True;end;ifEyeColor=′Green′thenwithGirlEyeGreenImagedobegin  Left=363+dx;  Top=266+dy;  Width=49;  Height=25;  Visible=True;end;ifEyeColor=′Brown′thenwithGirlEyeBrownImagedobeginLeft=363+dx;Top=266+dy;Width=49;Height=25;Visible=True;end;ifEyeColor=′Black′thenwithGirlEyeBlackImagedobegin  Left=359+dx;  Top=266+dy;  Width=49;Height=25;  Visible=True;  end;  ifFavoriteColor=′Yellow′then  withGirlShirtYellowImagedo  begin  Left=305+dx;  Top=303+dy;  Width=144;  Height=209;  Visible=True;  end;  ifFavoriteColor=′Blue′then  withGirlShirtBlueImagedo  begin  Left=302+dx;  Top=312+dy;  Width=147;  Height=193;  Visible=True;  end;  ifFavoriteColor=′Red′then  withGirlShirtRedImagedo  begin  Left=305+dx;  Top=315+dy;  Width=143;  Height=201;  Visible=True;  end;  end;end;procedureTRegistrationForm.AssignCurrentItem(Valuestring);beginifCurrentItem=′SecretName′then  begin  SecretName=Value;  AboutYouLabel.Visible=True;AboutSexLabel.Visible=True;  AboutAgeLabel.Visible=True;  AboutEyeLabel.Visible=True;  AboutHairLabel.Visible=True;  AboutBedTimeLabei.Visible=True;  FavoritesLabel.Visible=True;  FavoritesColorLabel.Visible=True;  FavoritesFoodLabel.Visible=True;  FavoritesActivityLabel.Visible=True;  FavoritesAnimalLabel.Visible=True;end;if(CurrentItem=′Gender′)and(Gender<>Value)thenbegin  DateOfBirth=′′;  EyeColor=′′;  HairColor=′′;  BedTimeHour=′′;  FavoriteColor=′′;  FavoriteFood=′′;  FavoriteActivity=′′;  FavoriteAnimal=′′;  Gender=Value;end;  ifCurrentItem=′DateOfBirth′thenDateOfBirth=Value;  ifCurrentItem=′EyeColor′thenEyeColor=Value;  ifCurrentItem=′HairColor′thenHairColor=Value;  ifCurrentItem=′BedTimeHour′thenBedTimeHour=Value;  ifCurrentItam=′FavoriteColor′thenFavoriteColor=Value;  ifCurrentItem=′FavoriteFood′thenFavoriteFood=Value;  ifCurrentItem=′FavoriteActivity′thenFavoriteActivity=Value;  ifCurrentItem=′FavoriteAnimal′thenFavoriteAnimal=Value;//  BackgroungSpeaking(Value);  SteemAnimate.Visible=True;  ShowVIfSelected;  //end;procedureTRegistrationForm.BackgroungSpeaking(Valuestring);varTalkStringstring;beginTalkString=′′;ifCurrentItem=′SecretName′then  begin  ifValue=′BubbleGum′thenTalkString=′fa75a′;  ifValue=′RainBow′thenTalkString=′fa75b′;  end;ifCurrehtItem=′Gender′then  begin  ifValue=′Boy′thenTalkString=′ay64′;  ifValue=′Girl′thenTalkString=′ay65′;  end;ifCurrentItem=′EyeColor′then  begin  ifValue=′Blue′thenTalkString=′ay66a′;  ifValue=′Green′thenTalkString=′ay66b′;  ifValue=′Brown′thenTalkString=′ay66c′;  ifValue=′Black′thenTalkString=′ay66d′;  end;ifCurrentItem=′HairColor′thenbegin  ifValue=′Blond′thenTalkString=′ay68a′;  ifValue=′Brown′thenTalkString=′ay68b′;  ifValue=′Red′thenTalkString=′ay68c′;  ifValue=′Black′thenTalkString=′ay68d′;  end;ifCurrentItem=′FavoriteColor′thenbegin  ifValue=′Yellow′thenTalkString=′fa71a′;  ifValue=′Blue′thenTalkString=′fa71b′;  ifValue=′Red′thenTalkString=′fa71c′;  end;ifCurrentItem=′FavoriteFood′thenbegin  ifValue=′Pizza′thenTalkString=′fa72a′;  ifValue=′FrenchFries′thenTalkString=′fa72b′;  ifValue=′MacaroniAndCheese′thenTalkString=′fa72c′;  end;ifCurrentItem=′FavoriteActivity′then  begin  ifValue=′Drawing′thenTalkString=′fa73a′;  ifValue=′PlayingComputerGames′thenTalkString=′fa73b′;  ifValue=′PlayMakeBelieve′thenTalkString=′fa73c′;  end;  ifCurrentItem=′FavoriteAnimal′then  begin  ifValue=′Horse′thenTalkString=′fa74a′;  ifValue=′Dog′thenTalkString=′fa74b′;  ifValue=′Cat′thenTalkString=′fa74c′;  end;  ifTalkString<>′′thenMainForm.BackGroundTalking(MainForm.AboutYouPath  +TalkString+′.wav′,′S′);end;procedureTRegistrationForm.RegistrationBackImageMouseMove(SenderTObject;ShiftTShiftState;X,YInteger);begin//GoOutArrowImage.Visible=True;end;procedureTRegistrationForm.GoOutArrowImageCiick(SenderTObject);beginifMainForm.ThreadInProgressthenexit;  GoBackToMenu;end;procedureTRegistrationForm.LoadFromDataBase;begin  ChildName=MainForm.PDBEngine.ChildName;  SecretName=MainForm.PDBEngine.SecretName;  Gender=MainForm.PDBEngine.Childsex;  DateOfBirth=MainForm.PDBEngine.BirthDay;  EyeColor=MainForm.PDBFngine.ChildEyeColor;  HairColor=MainForm.PDBEngine.ChildHairColor;  BedTimeHour=MainForm.PDBEngine.BedTimeHour;  FavoriteColor=MainForm.PDBEngine.FavoriteColor;  FavoriteFood=MainForm.PDBEngine.FavoriteFood;FavoriteActivity=MainForm.PDBEngine.FavoriteActivity;  FavoriteAnimal=MainForm.PDBEngine.FavoriteAnimal;end;procedureTRegistrationForm.SaveToDataBase;begin  MainForm.PDBEngine.ChildName=ChildName;  MainForm.PDBEngine.SecretName=SecretName;  MainForm.PDBEngine.ChildSex=Gender;  MainForm.PDBEngine.BirthDay=DateOfBirth;  MainForm.PDBEngine.ChildEyeColor=EyeColor;  MainForm.PDBEngine.ChildHairColor=HairColor;  MainForm.PDBEngine.BedTimaHour=BedTimeHour;  MainForm.PDBEngine.FavoriteColor=FavoriteColor;  MainForm.PDBEngine.FavoriteFood=FavoriteFood;  MainForm.PDBEngine.FavoriteActivity=FavoriteActivity;  MainForm.PDBEngine.FavoriteAnimal=FavoriteAnimal;  MainForm.PDBEngine.UpDateCurrentChild;end;procedureTRegistrationForm.ComboBox1Change(SenderTObject);begin  Calendarl.Month=ComboBox1.ItemIndex+1;end;ProcedureTRegistrationForm.SpinEditlChange(SenderTObject);begin  Calendarl.Year=SpinEditl.Value;end;procedureTRegistrationForm.CalendarlChange(SenderTObject);var  space1string;  space2string;begin  ifCalendarl.Month<10thenspace1=′0′elsespace1=′′;  ifCalendarl.Day<10thenspace2=′0′elsespace2=′′;  DateOfBirth=spacel+IntToStr(Calendarl.Month)+′/′+space2+  IntToStr(calendarl.Day)+′/′+IntToStr(Calendarl.Year);end;procedureTRegistrationForm.BirthDayImageClick(SenderTObject);beginifMainForm.ThreadInProgressthenexit;  BirthDayPanel.Visible=False;  ShowVTfSelected;end;procedureTRegistrationForm.RegistrationImageClick(SenderTObject);begin  ifMainForm.ThreadInProgressthenexit;  BirthDayPanel.Visible=False;  FavoritePanel.Visible=False;  BedTimeHourPanel.Visible=False;  SteemAnimate.Visible=True;  ShowVTfSelected;end;procedureTRegistrationForm.BedTimeHourImageClick(SenderTObject);beginifMainForm.ThreadInProgressthenexit;BedTimeHourPanel.Visible=False;ShowVIfSelected;end;procedureTRegistrationForm.ComboBox2Change(SenderTObject);begin  BedTimeHour=ComboBox2.Text;end;procedureTRegistrationForm.BirthDayOKImageClick(SenderTObject);begin//  ifMainForm.ThreadInProgressthenexit;  BirthDayPanel.Visible=False;  ShowVIfseletted;end;procedureTRegistrationForm.BedTimeHourOKImageClick(SenderTObject);begin//ifMainForm.ThreadInProgressthenexit;BedTimeHourPanel.Visible=False;ShowVIfSelected;end;procedureTRegistrationForm.ShowVIfSelected;begin  ifGender=′′thenVGenderImage.visible=FalseelseVGenderImage.visible=True;  ifDateOfBirth=′′thenVBirthdayImage.visible=FalseelseVBirthdayImage.visible=True;  ifEyeColor=′′thenVEyeColorImage.visible=FalseelseVEyeColorImage.visible=True;  ifHairColor=′′thenVHairColorImage.visible=FalseelseVHairColorImage.visible=True;  ifBedTimeHour=′′thenVBedTimeHourImage.visible=FalseelseVBedTimeHourImage.visible=True;  ifFavoriteColor=′′thenVFavoritecolorImage.visible=FalseelseVFavoriteColorImage.visible=True;  ifFavoriteFood=′′thenVFavoriteFoodImage.visible=FalseelseVFavoriteFoodImage.visible=True;  ifFavoriteActivity=′′thenVFavoriteActivityImage.visible=FalseelseVFavoriteActivityImage.visible=True;  ifFavoriteAnimal=′′thenVFavoriteAnimalImage.visible=FalseelseVFavoriteAnimalImage.visible=True;end;procedureTRegistrationForm.EscapelClick(SenderTObject);begin//  GoBackToMenu;end;end.================================  Copyright(c)1995-199gCreatorLtd.AllRightsReserved================================DescriptionThisistheSingAlongunit.unitSingAlong;interfaceusesWindows,Messages,SysUtils,Classes,Graphics,Controls,F(xiàn)orms,Dialogs,ExtCtrls,Menus;typeTSingAlongForm=class(TForm)  ImagelTImage;  StoryTellerImageTImage;  PeasImageTImage;  HeadImageTImage;  MainMenulTMainMenu;  testlTMenuItem;  spacelTMuItem;  TimerlTTimer;  procedurespacelClick(SenderTObject);  procedureTimerlTimet(SenderTObject);  procedureFormCreate(SenderTObject);private  (Privatedeclaretions)public  (Publicdeclaretions)  SongInteger;  procedurePlaySongs;  end;var  SingAlongFormTSingAlongForm;implementationusesMenu,Main,creator,PestoSong;(SR*.DEM)procedureTSingAlongForm.spacelClick(SenderTObject);begin//stopplayingandgobacktomenu  Timerl.Enabled=False;  Spacel.Enabled=False;  Hide;  MenuForm.Show;end;procedureTSingAlongForm.TimerlTimer(SenderTObject);begin  Timerl.Enabled=False;  Hide;  CreatorForm.Show;  CreatorForm.PlayMovie;end;procedureTSingAlongForm.FormCreate(SenderTObject);beginTimerl.Enabled=False;withStoryTellerImagedobegin  Left=125;  Top=80;  Width=453;  Height=453;  end;  withPeasImagedo  begin  Left=176;  Top=176;  Width=186;  Height=236;end;withHeadImagedobegin  Left=152;  Top=129;  Width=258;  Height=346;end;StoryTellerImage.Visible=True;PeasImage.Visible=False;  HeadImage.Visible=False;end;procedureTSingAlongForm.PlaySongs;begin//85=Broadcast  withPestoSongFormdo  begin  Spacel.Enabled=True;  Timerl.Enabled=True;  MediaPlayerl.Open;  end;  withCreatorFormdo  begin  Spacel.Enabled=True;  Timerl.Enabled=True;  MediaPlayerl.Open;  end;Timerl.Interval=3000;Timerl.Enabled=True;Song=1;StoryTellerImage.Visible=True;PeasImage.VisibIe=False;HeadImage.Visible=False;//MainForm.TalkInBackGround(85,MainForm.AudioPath+′StoryTeller.wav′,′′);end;end.================================  Copyright(c)1995-1998CreatorLtd.AllRightsReserved================================DescriptionThisistheStatusunit.unitStatus;interfaceusesWindows,Messages,SysUtils,Classes,Graphics,Controls,F(xiàn)orms,Dialogs,ComCtrls,Buttons,StdCtrls,jpeg,Gauges,ExtCtrls,Menus;typeTStatusForm=class(TForm)  StatusImageTImage;  GotoMenuImageTImage;  MinimizeImageTImage;  StatusGaugeTGauge;  LabellTLabel;  MainMenulTMainMenu;  testlTMenuItem;  EscapelTMenuItem;  StatusAnimateTAnimate;  SpeechLabelTLabel;  StandByLabelTLabel;  TalkErrorLabelTLabel;  procedureFormClose(SenderTObject;varActionTCloseAction);  procedureSpeedButtonlClick(SenderTObject);  procedureFormCreate(SenderTObject);  procedureSpeedButton2Click(SenderTObject);  procedureGotoMenuImgeClick(SenderTObject);  procedureMinimizeImageClick(SenderTObject);  procedureEscapelClick(SenderTObject);  procedureFormShow(SenderTObject);  procedureFormHide(SenderTObject);private  (Privatedeclarations)public  (Publicdeclarations)end;var  StatusFormTStatusForm;implementationusesMenu,Main,ToySimulation,MotionSimulation,PanelControls;(SR*.DFM)procedureTStatusForm.FormClose(SenderTObject;varActionTCloseAction);begin  StatusAnimate.Active=False;  MenuForm.Show;  ifMenuForm.Threadl<>nilthen  begin  MenuForm.Threadl.Terminate;  end;end;procedureTStatusForm.SpeedButtonlClick(SenderTObject);begin  SimulationForm.Close;  MotionSimulationForm.Close;  close;  MenuForm.Show;end;procedureTStatusForm.FormCreate(SenderTObject);begin  //Icon.LoadFromFile(MainForm.GraphicsPath+′PestoIcon.ico′);  StatusAnimate.FileName=MainForm.GraphicsPath+′top.AVT′;  StatusAnimate.Active=True;  GotoMenuImage.Cursor=5;  MinimizeImage.Cursor=5;end;procedureTStatusForm.SpeedButton2Click(SenderTObject);beginApplication.Minimize;end;procedureTStatusForm.GotoMenuImageClick(SenderTObject);beginSimulationForm.Close;  MotionSimulationForm.Close;  close;  MenuForm.Show;end;procedureTStatusForm.MinimizeImageClick(SenderTObject);begin  Application.Minimize;end;procedureTStatusForm.EscapelClick(SenderTObject);begin  SimulationForm.Close;  MotionSimulationForm.Close;  close;  MenuForm.Show;end;procedureTStatusForm.FormShow(SenderTObject);beginPanelControlForm.Show;end;procedureTStatusForm.FormHide(SenderTObject);beginPanelControlForm.Hide;end;end.================================  Copyright(c)1995-1998CreatorLtd.AllRightsReserved================================DescriptionThisistheToyunit.unitToy;(ThisUnitcontainedseveralmethods,convertingfromDll/OcxtoSimplemethods)interfaceusesWindows,Messages,SysUtils,Classes,Graphics,Controls,  Forms,Dialogs;typeTToy=class(TComponent)private  (Privatedeclarations)  FToyNumberInteger;public  (Publicdeclarations)  functionTalk(TalkFilesstring;Motionstring)Integer;  functionTalkAndListen(TalkFilesstring;TalkMotionstring;  ListenTimeReal;ListenMotionstring)Integer;  functionWait(ListenTimeReal;Motionstring)Integer;  functionListen(Mapstring;DelayTimeReal;  deviceString;Motionstring)Integer;  functionTurnOnBoolean;  functionTurnOffBoolean;  functionCheckToySystemInteger;  functionListenConv(ListenMotionstring)Integer;  functionTalkConv(ListenMotionstring)Integer;  functionRecordWave(WaveFilestring;DelayTimeReal;  MotionString)Integer;  functionListenActive(Mapstring;DelayTimeReal;  deviceString;Motionstring)Integer;  functionTalkAll(TalkFilesstring;Motionstring)Integer;  functionToyTalkIn(ToyNumberValueInteger;TalkFilesstring;LTimeInteger;Motionstring)Integer;  functionToyListenIn(DTimeInteger;Motionstring)Integer;  published  propertyToyNumberintegerreadFToyNumberwriteFToyNumber;  end;const  SBDevice=0;  AllToys=85;implementationuses  Main,ToySimulation,MotionSimulation,status;//**************************************************************************//ExamplesTalk(′a.wav+b.wav+c.wav′,′MotorandListen∷1.5);//ListenTime=1.5sec//sensors1-Nose2-Hand3-Foot;0-nonefunctionTToy.Talk(TalkFilesstring;Motionstring)Integer;var  LTimeinteger;  SensorFlagBoolean;  SensorNumberInteger;  iInteger;begin  LTime=12000;  StatusForm.TalkErrorLabel.Visible=False;  ifToyNumber<0then  begin  simulationForm.ToyTalk(TalkFiles,Motion,0(LTime));//fix  While(SimulationForm.ToyTalkStatus=True)or  (SimulationForm.ToyListenStatus=True)do  sleep(500);  //Sleep(1000);//LimitationoftheEquipment//fix  Result=SimulationForm.KeyPress;  end//===============================  else  begin//ToyNumber>0  Result=ToyTalkIn(ToyNumber,TalkFiles,LTime,Motion);  ifResult<0then  begin  sleep(250);Result=ToyTalkIn(ToyNumber,TalkFiles,LTime,Motion);  end; ifResult<0then  begin  StatusForm.TalkErrorLabel.Visible=True;  sleep(1000);  Result=ToyTalkIn(ToyNumber,TalkFiles,LTime,Motion);  end;  ifResult<0then  begin  sleep(1000);  Result=ToyTalkIn(ToyNumber,TalkFiles,LTime,Motion);  end;  ifResult=-2then  begin  sleep(20000);  Result=ToyTalkIn(ToyNumber,TalkFiles,LTime,Motion);  end;  ifResult=-2then  begin  sleep(20000);  Result=ToyTalkIn(ToyNumber,TalkFiles,LTime,Motion);  end;  end;end;//*****************************************************************functionTToy.TalkAll(TalkFilesstring;Motionstring)Integer;varLTimeinteger;SensorFlagBoolean;SensorNumberInteger;iInteger;beginLTime=50;ifToyNumber<0thenbegin  SimulationForm.ToyTalk(TalkFiles,Motion,LTime);While(SimulationForm.ToyTalkStatus=True)or  (SimulationForm.ToyListenStatus=True)do  sleep(500);  Sleep(1000);//LimitationoftheEquipment  Result=SimulationForm.KeyPress;  end//=========================================  else  begin//ToyNumber>0  Result=ToyTalkIn(AllToys,TalkFiles,LTime,Motion);  ifResult<0then  Result=ToyTalkIn(AllToys,TalkFiles,LTime,Motion);  end;end;//**********************************************************************************functionTToy.Wait(ListenTimeReal;Motionstring)Integer;varLTimeinteger;begin//=========================================LTime=Trunc(1000*ListenTime);SimulationForm.ToyListen(LTime,Motion);While(SimulationForm.ToyTalkStatus=True)or  (SimulationForm.ToyListenStatus=True)do  sleep(200);Sleep(1000);//LimitationoftheEquipmentResult=SimulationForm.KeyPress;//========================================={Result=MainForm.XMidil.ToyListen2(ToyNumber,Trunc(LTime*10),ListenConv(Motion));Result=MainForm.SR1.WaitForEvent(″,Trunc(LTime*10),2);//Sensors}//=========================================end;//**********************************************************************************//sensors1-Nose2-Hand3-Foot;0-nonefunctionTToy.Listen(MapstringDelayTimeReal;  deviceString;Motionstring)Integer;varDTimeInteger;FlagsInteger;  SRisOnBoolean;begin  sleep(100);  DTime=Trunc(DelayTime*10);  Flags=0;  ifPos(′SR′,Device)>0then  begin  Flags=Flags+1;  SRisOn=True;  end  elseSRisOn=False;  ifPos(′Sensor′,Device)>0thenFlags=Flags+2;  StatusForm.SpeechLabel.Visible=True;  Result=MainForm.srl.WaitForEvent(Map,DTime,F(xiàn)lags);  StatusForm.SpeechLabel.Visible=False;  if(Result>0)and(MainForm.srl.GetPhraseConfLevel(1)<5000)and  (SRisOn=True)thenResult=0;end;//**********************************************************************************//sensors1-Nose2-Hand3-Foot;0-nonefunctionTToy.ListenActive(Mapstring;DelayTimeReal;  deviceString;Motionstring)Integer;varDTimeInteger;FlagsInteger;SRisOnBoolean;beginResult=1;DTime=Trunc(DelayTime*10);ifToyNumber>-1then  begin  Result=ToyListenIn(DTime,Motion);  ifResult<>1then  Result=ToyListenIn(DTime,Motion);  ifResult<>1then  begin  Result=ToyListenIn(DTime,Motion);  end;  end  else  Result=1;Flags=0;ifPos(′SR′,Device)>0then  begin  Flags=Flags+1;  SRisOn=True;  end  elseSRisOn=False;  ifPos(′Sensor′,Device|>0thenFlags=Flags+2;  sleep(100);  ifResult=1then  begin  StatusForm.SpeechLabel.Visible=True;  Result=MainForm.srl.WaitForEvent(Map,DTime,F(xiàn)lags);  StatusForm.SpeechLabel.Visible=False;  if(Result>0)and(MainForm.srl.GetPhraseConfLevel(1)<5000)and  (SRisOn=True)thenResult=0;  end  elseifResult=-2thenResult=-9999;end;//**********************************************************************************functionTToy.TalkAndListen(TalkFilesstring;TalkMotionstring;  ListenTimeReal;ListenMotionstring)Integer;varFlagsInteger;LTimeInteger;beginFlags=0;Ltime=0;{SimulationForm.ToyTalk(TalkFiles,Motion,LTime);While(SimulationForm.ToyTalkStatus=True)or  (SimulationForm.ToyListenStatus=True)do  sleep(500);Sleep(1000);//LimitationoftheEquipmentResult=SimulationForm.KeyPress;}//=========================================//Result=MainForm.XMidil.ToyTalk2(ToyNumber,TalkFiles,  //SBDevice,0,0,0);//=========================================end;//**********************************************************************************functionTToy.TurnOnBoolean;var  ResultSRInteger;  ResultXMidiInteger;begin  //openSR  {withMainFormdo  begin  SR1.DataBase=′ASR1500-Telephone′;  SR1.User=′Creator′;  SR1.Context=′Demo′;  SR1.OpenAttr=0;  ResultSR=SR1.Init;  end;}  ResultSR=MainForm.SR1.Init;//openMIDIResultXMidi=MainForm.XMidil.StartHUB;if(MainForm.ToyMachine=MainForm.ToyNameIsBear)thenMainForm.XMidil.SetMotor(ToyNumber,0,1,200);  Result=(ResultSR=0)AND(ResultXMidi=0);end;functionTToy.TurnOffBoolean;varResultSRInteger;ResultXMidiInteger;begin  //closeSR&amp;amp;MIDI  ResultSR=MainForm.SR1.Close;  ResultXMidi=MainForm.XMidil.StopHUB;  Result=(ResultSR=0)AND(ResultXMidi=0);end;//0=OK,-1=LowBattery,-2=NoCommunication//-3=LowBattery&amp;amp;NoCommunicationfunctionTToy.CheckToySystemInteger;beginResult=0;end;functionTToy.ListenConv(ListenMotionstring)Integer;beginResult=0;ifListenMotion=′W′thenResult=0;ifListenMotion=′X′thenResult=1;ifListenMotion=′Y′thenResult=2;ifListenMotion=′Z′thenResult=3;end;functionTToy.TalkConv(ListenMotionstring)Integer;beginResult=0;ifListenMotion=′S′thenResult=0;ifListenMotion=′EC′thenResult=1;ifListenMotion=′E′thenResult=2;ifListenMotion=′EL′thenResult=3;ifListenMotion=′S#′thenResult=4;ifListenMotion=′X′thenResult=5;ifListenMotion=′X′thenResult=6;ifListenMotion=′X′thenResult=7;ifListenMotion=′X′thenResult=8;ifListenMotion=′X′thenResult=9;ifListenMotion=′X′thenResult=10;ifListenMotion=′X′thenResult=11;ifListenMotion=′X′thenResult=12;ifListenMotion=′X′thenResult=13;ifListenMotion=′X′thenResult=14;ifListenMotion=′X′thenResult=15;ifListenMotion=′X′thenResult=16;ifListenMotion=′X′thenResult=17;ifListenMotion=′X′thenResult=18;ifListenMotion=′X′thenResult=19;ifListenMotion=′X′thenResult=20;ifListenMotion=′X′thenResult=21;ifListenMotion=′X′thenResult=22;ifListenMotion=′X′thenResult=23;ifListenMotion=′x′thenResult=24;ifListenMotion=′X′thenResult=25;ifListenMotion=′X′thenResult=26;ifListenMotion=′X′thenResult=27;ifListenMotion=′X′thenResult=28;ifListenMotion=′X′thenResult=29;ifListenMotion=′X′thenResult=30;end;functionTToy.RecordWave(WaveFilestring;DelayTimeReal;  MotionString)Integer;var  DTimeInteger;begin  Wait(DelayTime,Motion);  DTime=Trunc(DelayTime*10);  Result=MainForm.XMidil.ToyRecord(WaveFile,DTime);end;functionTToy.ToyTalkIn(ToyNumberValueInteger;TalkFilesstring;  LTimeInteger;Motionstring)Integer;begin  sleep(100);  if(MainForm.ToyMachine=′StoryTeller′)and(ToyNumber<>85)then  Result=MainForm.XMidil.ToyTalk2(ToyNumber,TalkFiles,  SBDevice,LTime,TalkConv(Motion),0);  if(MainForm.ToyMachine=′TeddyBear′)or(ToyNumber=85)then Result=MainForm.XMidil.NewToyTalk(ToyNumber,TalkFiles,  SBDevice,9,LTime);end;functionTToy.ToyListenIn(DTimeInteger;Motionstring)Integer;beginsleep(100);ifMainForm.ToyMachine=′StoryTeller′then  Result=MainForm.XMidil.ToyListen2(ToyNumber,DTime,ListenConv(Motion));ifMainForm.ToyMachine=′TeddyBear′then  Result=MainForm.XMidil.ToyListenTime(ToyNumber,DTime);end;end.=========================================  Copyright(c)1995-1998CreatorLtd.AllRightsReserved=========================================DescriptionThisistheIntrounit.unitIntro;interfaceusesStatus,Main,Toy,PanelControls,Windows,Messages,SysUtils,Classes,Graphics,Controls,F(xiàn)orms,Dialogs,Registration;typeTIntro=class(TThread)private  {Privatedeclarations}  GameStatusstring;  ChildNamestring;  SecretNamestring;  DateOfBirthstring;  EyeColorstring;  HairColorstring;  BedTimeHourstring;  FavoriteColorstring;  FavoriteFoodstring;  FavoriteActivitystring;  FavoriteAnimalstring;  ChildSexstring;  IntroNextSectionInteger; PlayNextSectionInteger;  PrincessNextSectionInteger;  TheStoryMenuNextSectionInteger;  RunStoryMenuNextSectionInteger;  BedTimeRitualNextSectionInteger;  GrouchyNextSectionInteger;  BunnyNextSectionInteger;  PresentationNextSectionInteger;  VisitSongMenuInteger;  VisitGameMenuInteger;  VisitStoryMenuInteger;VisitBunnyShortInteger;  VisitBunnyLongInteger;  VisitPrincessInteger;  BunnyFavoriteFoodstring;protected  procedureExecute;override;  procedureLoadDataFromDatabsse;  procedureSaveDataFromDatabase;  procedureUpdateIntroBar;  procedureUpdatePlayBar;  procedureUpdatePrincessBar;  procedureUpdateTheStoryMenuBar;  procedureUpdateRunStoryMenuBar;  procedureUpdateBedTimeRitualBar;  procedureUpdateGrouchyBar;  procedureUpdateBunnyBar;  procedureUpdatePresentationBar;  procedureApplicationMinimize;  procedureClearStatusControl;public  constructorCreate(Statusstring);end;//sensors1-Nose2-Hand3-FootconsttNoseSensor=2;HandSensor=1;FootSensor=3;implementation{ImportantMethodsandpropertiesofobjectsinVCLcanonlybeusedinamethodcalledusingSynchronize,forexample,  Synchronize(UpdateCaption);andUpdateCaptioncouldlooklike,  procedureTIntro.UpdateCaption;  begin  Forml.Caption=′UPdatedinathread′;  end;}{TIntro}constructorTIntro.Create(Statusstring);begininheritedCreate(False);FreeOnTerminate=True;GameStatus=Status;end;procedureTIntro.LoadDataFromDatabase;begin  //GetCurrentDataFromdatabase  ChildName=Trim(MainForm.PDBEngine.ChildName);  SecretName=Trim(MainForm.PDBEngine.SecretName);  ChildSex=Trim(MainForm.PDBEngine.ChildSex);  DateOfBirth=Trim(MainForm.PDBEngine.BirthDay);  EyeColor=Trim(MainForm.PDBEngine.ChildEyeColor);  HairColor=Trim(MainForm.PDBEngine.ChildHairColor);  BedTimeHour=Trim(MainForm.PDBEngine.BedTimeHour);  FavoriteColor=Trim(MainForm.PDBEngine.FavoriteColor);  FavoriteFood=Trim(MainForm.PDBEngine.FavoriteFood);  FavoriteActivity=Trim(MainForm.PDBEngine.FavoriteActivity);  FavoriteAnimal=Trim(MainForm.PDBEngine.FavoriteAnimal);  VisitSongMenu=MainForm.PDBEngine.VisitSongMenu;  VisitGameMenu=MainForm.PDBEngine.VisitGameMenu;  VisitStoryMenu=MainForm.PDBEngine.VisitStoryNenu;  VisitBunnyShort=MainForm.PDBEngine.VisitBunnyShort;  VisitBunnyLong=MainForm.PDBEngine.VisitBunnyLong;  VisitPrincess=MainForm.PDBEngine.VisitPrincess;  BunnyFavoriteFood=MainForm.PDBEngine.BunnyFavoriteFood;end;procedureTIntro.SaveDataFromDatabase;begin  //SaveCurrentDataTodatabase  MainForm.PDBEngine.VisitSongMenu=VisitSongMenu;  MainForm.PDBEngine.VisitGameMenu=VisitGameMenu;  MainForm.PDBEngine.VisitStoryMenu=VisitStoryMenu;  MainForm.PDBEngine.VisitBunnyShort=VisitBunnyShort;  MainForm.PDBEngine.VisitBunnyLong=VisitBunnyLong;  MainForm.PDBEngine.VisitPrincess=VisitPrincess;  MainForm.PDBEngine.BunnyFavoriteFood=BunnyFavoriteFood;end;procedureTIntro.Execute;varParamTalkInteger;ParanmListenInteger;ToyTToy;LastPresentationInteger;Pathstring;IntroPathstring;BedTimePathstring;BunnyPathstring;GrouchyPathstring;PeasPathstring;PlayPathstring;RunStoryPathstring;SillyPathstring;SongMenuPathstring;SongsPathstring;StoryMenuPathstring;PresentationPathstring;GamePrincessStatusstring;WaveSectionstring;Sensor1Integer;Sensor2Integer;Sensor3Integer;GetSensorInteger;LoopCountInteger;DTimeInteger;BeginningPlayBoolean;begin{Placethreadcodehere}Toy=MainForm.Toy;Path=MainForm.AudioPath;IntroPath=Path+′Intro\′;BedTimePath=Path+′BedTime\′;BunnyPath=Path+′Bunny\′;GrouchyPath=Path+′Grouchy\′;PeasPath=Path+′Peas\′;PlayPath=Path+′Play\′;RunStoryPath=Path+′RunStory\′;SillyPath=Path+′Silly\′;SongMenuPath=Path+′SongMenu\′;SongsPath=Path+′Songs\′;StoryMenuPath=Path+′StoryMenu\′;PresentationPath=Path+′Presentation\′;  LastPresentation=0;  ParamTalk=0;  LoopCount=0;  Sensor1=0;  Sensor2=0;  Sensor3=0;  DTime=5; BeginningPlay=True;  Synchronize(LoadDataFromDatabase);  ifGameStatus=′Intro′then//=====HowToPlay========  begin  IntroNextSection=-1;//UnPerformIntroScript  PlayNextSection=-1;//UnPerformPlayScript  PrincessNextSection=-1;//UnPerformPrincessScript  TheStoryMenuNextSection=-1;//UnPerformTheStoryMenuScript  RunStoryMenuNextSection=-1;//UnPerformRunStoryMenuScript  BedTimeRitualNextSection=-1;//UnPerformBedTimeRitualScript  GrouchyNextSection=-1;//UnPerformGrouchyScript  BunnyNextSection=-1;//UnPerfomBunnyScript  PresentationNextSection=-1;//UnPerfomPresentationDemoVer1.0  endelse  begin//=====Play=================  IntroNextSection=-1;//UnPerformIntroScript  PlayNextSection=-1;//UnPerformPlayScript  PrincessNextSection=-1;//UnPerformPrincessScript  TheStoryMenuNextSection=-1;//UnPerformTheStoryMenuScript  RunStoryMenuNextSection=-1;//UnPerformRunStoryMenuScript  BedTimeRitualNextSection=-1;//UnPerformBedTimeRitualScript  GrouchyNextSection=-1;//UnPerformGrouchyScript  BunnyNextSection=-1;//UnPerformBunnyScript  PresentationNextSection=1;//PerformPresentationDemoVer1.0  end;StatusForm.StatusGauge.Progress=0;whilenotTerminateddobegin//Checking  (ifStatusForm.WindowState=wsMinimizedthenbegin  //Synchronize(ApplicationMinimize);  end;}//==========Presentation============//----------------writehereallsessions-------------------//==============================  casePresentationNextSectionof  1begin  PresentationNextSection=5;  end;  5begin    ParamTalk=Toy.Talk(PresentationPath+′op002.wav′,′S′);  Synchronize(UpdatePresentationBar);  PresentationNextSection=6;  end;  6begin  ParamListen=Toy.ListenActive(″,180,′Sensor′,′W′);  if(ParamListen=FootSensor)or(ParamListen=NoseSensor)thenPresentationNextSection=10  elsePresentationNextSection=5;  //PresentationNextSection=10;//??Deletethisline  end;10begin  BeginningPlay=False;  ifTime<StrToTime(′120000′)thenPresentationNextSection=15  elseifTime>StrToTime(′160000′)thenPresentationNextSection=25  elsePresentationNextSection=20;  end;  15begin  ParamTalk=Toy.Talk(PresentationPath+′op015m.wav′,′S′);  Synchronize(UpdatePresentationBar);  PresentationNextSection=35;  end;20begin  ParamTalk=Toy.Talk(PresentationPath+′op020m.wav′,′S′);  Synchronize(UpdatePresentationBar);  PresentationNextSection=35;  end;25begin  ParamTalk=Toy.Talk(PresentationPath+′op025m.wav′,′S′);  Synchronize(UpdatePresentationBar);  PresentationNextSection=35;  end;35begin  SecretName=′Rainbow′;  ParamListen=Toy.Listen(′rainbow/2,bubblegum/3′,  7,′SR′,′W′);  caseParamListenof  2begin  PresentationNextSection=45;  SecretName=′Rainbow′;  end;  3begin  PresentationNextSection=50;  SecretName=′BubbleGum′;  end;  elsePresentationNextSection=36;  end;  Synchronize(UpdatePresentationBar);  end;36begin  ParamTalk=Toy.Talk(PresentationPath+′op036m.wav′,′S#′);  Synchronize(UpdatePresentationBar);  PresentationNextSection=55;  end;45begin  ParamTalk=Toy.Talk(PresentationPath+′op045m.wav′,′S#′);  Synchronize(UpdatePresentationBar);  PresentationNextSection=55;  end;50begin  ParamTalk=Toy.Talk(PresentationPath+′op050m.wav′,′S#′);  Synchronize(UpdatePresentationBar);  PresentationNextSection=55;  end;  55begin  ParamListen=Toy.Listen(′story/1,game/2,song/3′,  7,′SR′,′W′);  caseParamListenof  1PresentationNextSection=100;//storymenu  2PresentationNextSection=800;//gamemenu  3PresentationNextSection=300;//songmenu  elsePresentationNextSection=60;  end;  Synchronize(UpdatePresentationBar);  end;  60begin  ParamTalk=Toy.Talk(PresentationPath+′op060.wav′,′S#′);  Synchronize(UpdatePresentationBar);  PresentationNextSection=65;  end;  65begin  ParamListen=Toy.Listen(′story/1,game/2,song/3′  7,′SR′,′W′);  caseParamListenof  1PresentationNextSection=100;//storymenu  2PresentationNextSection=800;//gamemenu  3PresentationNextSection=300;//songmenu  elsePresentationNextSection=100;  end;  Synchronize(UpdatePresentationBar);  end;//storymenu100begin  ifVisitStoryMenu=0thenPresentationNextSection=125  else  begin  PresentationNextSection=235;  ifVisitBunnyShort=0thenbegin  PresentationNextSection=105;  ifSecretName=′BubbleGum′thenPresentationNextSection=115;  ifSecretName=′Rainbow′thenPresentationNextSection=110;  end;  if(VisitBunnyLong=0)and(VisitBunnyShort<>0)thenPresentationNextSection=206;  if(VisitBunnyShort<>0)and(VisitBunnyLong<>0)thenPresentationNextSection=235;  end;  VisitStoryMenu=VisitStoryMenu+1;  end;110begin  ParamTalk=Toy.Talk(PresentationPath+′stm110.wav′,′S′);  Synchronize(UpdatePresentationBar);  PresentationNextSection=200;  end;115begin  ParamTalk=Toy.Talk(PresentationPath+′stm115.wav′,′S′);  Synchronize(UpdetePresentationBar);  PresentationNextSection=200;  end;125begin  ParamTalk=Toy.Talk(PresentationPath+′stm125m.wav′,′S′);  Synchronize(UpdatePresentationBar);  PresentationNextSection=130;  end;130begin  ParamTalk=Toy.Talk(PresentationPath+′stm130m.wav′,′S′);  Synchronize(UpdatePresentationBar);  PresentationNextSection=135;  end;135begin  ParamTalk=Toy.Talk(PresentationPath+′stm135m.wav′,′S′);  Synchronize(UpdatePresentationBar);  PresentationNextSection=140end;140begin  ParamTalk=Toy.Talk(PresentationPath+′stm140m.wav′,′S#′);  Synchronize(UpdatePresentationBar);  PresentationNextSection=145;  end;145begin  ParamListen=Toy.Listen(′toohot/1,toocold/2,justright/3′,  DTime,′SR′,′W′);  caseParamListenof  1PresentationNextSection=150;  2PresentationNextSection=155;  3PresentationNextSection=160;  elsePresentationNextSection=165;  end;  Synchronize(UpdatePresentationBar);  end;150begin  ParamTalk=Toy.Talk(PresentationPath+′stm50.wav′,′S′);  Synchronize(UpdatePresentationBar); PresentationNextSection=170;  end;155begin  ParamTalk=Toy.Talk(PresentationPath+′stm155.wav′,′S′);  Synchronize(UpdatePresentationBar);  PresentationNextSection=170;  end;160begin  ParamTalk=Toy.Talk(PresentationPath+′stm160.wav′,′S′);  Synchronize(UpdatePresentationBar);  PresentationNextSection=170;  end;165begin  ParamTalk=Toy.Talk(PresentationPath+′stm165.wav′,′S′);  Synchronize(UpdatePresentationBar);  PresentationNextSection=170;  end;170begin  ParamTalk=Toy.Talk(PresentationPath+′stm170.wav′,′S#′); Synchronize(UpdatePresentationBar);  PresentationNextSection=175;  end;175begin  ParamListen=Toy.Listen(′yes/1,no/2′,DTime,′SR′,′W′);  caseParamListenof  1PresentationNextSecticn=195;  2PresentationNextSection=225;  elsePresentationNextSection=180;  end;  Synchronize(UpdatePresentationBar);  end;180begin  PeramTalk=Toy.Talk(PresentationPath+′stm80.wav′,′S′);  Synchronize(UpdatePresentationBar);  PresentationNextSection=185;  end;185begin  PeraamListen=Toy.Listen(′yes/1,no/2′,DTime,′SR′,′W′);  caseParamListenof  1PresentationNextSection=195;  2PresentationNextSection=230;  elsePresentationNextSection=230;  end;  Synchronize(UpdatePresentationBar);  end;195begin  ParamTalk=Toy.Talk(PresentationPath+′stm195.wav′,′S′);  Synchronize(UpdatePresentationBar);  PresentationNextSection=200;  end;200begin  ParamTalk=Toy.Talk(PresentationPath+′stm00.wav′,′S′);  Synchronize(UpdatePresentationBar);  PresentationNextSection=3000;//bunnyshortend;205begin  ParamTalk=Toy.Talk(PresentationPath+′stm205m.wav′,′S′);  Synchronize(UpdatePresentationBar);  PresentationNextSection=210;  end;206begin  ParamTalk=Toy.Talk(PresentationPath+′stm206m.wav′,′S#′);  Synchronize(UpdatePresentationBar);  PresentationNextSection=210;  end;210begin  ParamListen=Toy.Listen(′yes/1,no/2′,DTime,′SR′,′W′);  caseParamListenof  1PresentationNextSection=2000;//bunnylong  2PresentationNextSection=225;  elsePresentationNextSection=215;  end;  Synchronize(UpdatePresentationBar);  end;215begin  ParamTalk=Toy.Talk(PresentationPath+′stm215m.wav′,′S#′);  Synchronize(UpdatePresentationBar);  PresentationNextSection=220;  end;220begin  ParamListen=Toy.Listen(′yes/1,no/2′,DTime,′SR′,′W′);  caseParamListenof  1PresentationNextSection=2000;//bunnylong  2PresentationNextSection=225;  elsePresentationNextSection=225;  end;  Synchronize(UpdatePresentationBar);  end;225begin  ParamTalk=Toy.Talk(PresentationPath+′stm225.wav′,′S′);  Synchronize(UpdatePresentationBar);PresentationNextSection=230;  end;230begin  ParamTalk=Toy.Talk(PresentationPath+′stm230n.wav′,′S#′);  Synchronize(UpdatePresentationBar);  PresentationNextSection=240;  end;240begin  ParamListen=Toy.Listen(′game/1,song/2,storyteller/3′,DTime,′SR′,′W′);  caseParamListenof  1PresentationNextSection=800;//gamemenu  2PresentationNextSection=300;//songmenu  3PresentationNextSection=5000;//themesong  elsePresentationNextSection=245;  end;  Synchronize(UpdatePresentationBar);  end;245begin  ParamTalk=Toy.Talk(PresentationPath+′stm245n.wav′,′S#′);  Synchronize(UpdatePresentationBar);  PresentationNextSection=250;  end;250begin  ParamListen=Toy.Listen(′game/1,song/2,storyteller/3′,DTime,′SR′,′W′);  caseParamListenof  1PresentationNextSection=800;//gamemenu  2PresentationNextSection=300;//songmenu  3PresentationNextSection=5000;//themesong  elsePresentationNextSection=800;  end; Synchronize(UpdatePresentationBar);  end;//songmenu300begin  Synchronize(UpdatePresentationBar);  ifVisitSongMenu=0thenPresentationNextSection=320  elsebegin  PresentationNextSection=305;  ifSecretName=′BubbleGum′thenPresentationNextSection=315;  ifSecretName=′Rainbow′thenPresentationNextSection=310;  end;  VisitSongMenu=VisitSongMenu+1  end;  310begin  ParamTalk=Toy.Talk(PresentationPath+′sng310.wav′,′S′);  Synchronize(UpdatePresentationBar);  PresentationNextSection=330;  end;315begin  ParamTalk=Toy.Talk(PresentationPath+′sng315.wav′,′S′);  Synchronize(UpdatePresentationBar);  PresentationNextSection=330;  end;320begin  ParamTalk=Toy.Talk(PresentationPath+′sng320.wav′,′S′);  Synchronize(UpdatePresentationBar);  PresentationNextSection=330;  end;330begin  ParamTalk=Toy.Talk(PresentationPath+′sng_prog.wav′,′S′);  Synchronize(UpdatePresentationBar);  PresentationNextSection=370;  end;370begin  ParamTalk=Toy.Talk(PresentationPath+′sng370.wav′,′S#′);  Synchronize(UpdatePresentationBar);  PresentationNextSection=375;  end;375begin  ParamListen=Toy.Listen(′yes/1,no/2′,DTime,′SR′,′W′);  caseParamListenof1PresentationNextSection=380;  2PresentationNextSection=395;  elsePresentationNextSection=395;  end;  Synchronize(UpdatePresentationBar);  end;380begin  ParamTalk=Toy.Talk(PresentationPath+′sng380m.wav′,′S′);  Synchronize(UpdatePresentationBar);  PresentationNextSection=390;  end;390begin  ParamTalk=Toy.Talk(PresentationPath+′sng390.wav′,′S′);  Synchronize(UpdatePresentationBar);  PresentationNextSection=395;  end;395begin  ParamTalk=Toy.Talk(PresentationPath+′sng395.wav′,′S#′);  Synchronize(UpdatePresentationBar);  PresentationNextSection=400;  end;400begin  ParamListen=Toy.Listen(′game/1,story/2,song/3′,DTime,′SR′,′W′);  caseParamListenof  1PresentationNextSection=800;//gamemenu  2PresentationNextSection=100;//storymenu  3PresentationNextSection=410;  elsePresentationNextSection=410;  end;  Synchronize(UpdatePresentationBar);  end;410begin  ParamTalk=Toy.Talk(PresentationPath+′sng410m.wav′,′S′);  Synchronize(UpdatePresentationBar);  PresentationNextSection=415;  end;415begin  ParamTalk=Toy.Talk(PresentationPath+′sng415n.wav′,′S#′);  Synchronize(UpdatePresentationBar);  PresentationNextSection=420;  end;420begin  ParamListen=Toy.Listen(′game/1,story/2,storyteller/3′,DTime,′SR′,′W′);  caseParamListenof  1PresentationNextSection=800;//gamemenu  2PresentationNextSection=100;//storymenu  3PresentationNextSection=5000;//themesong  elsePresentationNextSection=425;  end;  Synchronize(UpdatePresentationBar);  end;425begin  ParamTalk=Toy.Talk(PresentationPath+′sng425n.wav′,′S#′);  Synhronize(UpdatePresentationBar);  PresentationNextSection=430;  end;430begin  ParamListen=Toy.Listen(′game/1,story/2,storyteller/3′,DTime,′SR′,′W′);  caseParamListenof  1PresentationNextSection=800;//gamemenu  2PresentationNextSection=100;//storymenu  3PresentationNextSection=5000;//theesong  elsePresentationNextSection=800;  end;  Synchronize(UpdatePresentationBar);  end;//StandBy699begin  ParamListen=Toy.ListenActive(′continue/1,youreon/2,theme/3′,12,′SR′,′W′);  caseParamListenof  1PresentationNextSection=LastPresentation;  2PresentationNextSection=10;  3PresentationNextSection=700;elsePresentationNextSection=699;  end;  Synchronize(UpdatePresentationBar);  end;700begin//Speechbeforethemesong  ParamTalk=Toy.Talk(PresentationPath+′sb700.wav′,′S′);  Synchronize(UpdatePresentationBar);  PresentationNextSection=5000;  end;//WakeUp750begin  ParamTalk=Toy.Talk(PresentationPath+′op005.wav′,′S#′);  ifParamTalk=-2then  begin  PresentationNextSection=750;  sleep(200);  end  else  PresentationNextSection=760;  Synchronize(UpdatePresentationBar);  end;760begin  ParamListen=Toy.ListenActive(′yes/1,no/2′,12,′SR′,′W′);  caseParamListenof  1PresentationNextSection=LastPresentation;  2PresentationNextSection=10;  elsePresentationNextSection=LastPresentation;  end;  Synchronize(UpdatePresentationBar);  end;//GemeMenu800begin  ifVisitGameMenu=0thenPresentationNextSection=820  else  begin  PresentationNextSection=805;  ifSecretName=′BubbleGum′thenPresentationNextSection=815;  ifSecretName=′Rainbow′thenPresentationNextSection=810;end;  VisitGameMenu=VisitGameMenu+1;  end;810begin  ParamTalk=Toy.Talk(PresentationPath+′gm810.wav′,′S′);  Synchronize(UpdatePresentationBar);  PresentationNextSection=841;  end;815begin  ParamTalk=Toy.Talk(PresentationPath+′gm815.wav′,′S′);  Synchronize(UpdatePresentationBar);  PresentationNextSection=841;  end;820begin  ParamTalk=Toy.Talk(PresentationPath+′gm820m.wav′,′S′);  Synchronize(UpdatePresentationBar); PresentationNextSection=967; end;840begin  ParamTalk=Toy.Talk(PresentationPath+′gm840.wav′,′S′);  Synchronize(UpdatePresentationBar);  PresentationNextSection=841;  end;841begin  ParamTalk=Toy.Talk(PresentationPath+′gm841.wav′,′S′);  Synchronize(UpdatePresentationBar);  PresentationNextSection=845;  end;845begin  ParamTalk=Toy.Talk(PresentationPath+′gm845.wav′,′S′);  Synchronize(UpdatePresentationBar);  PresentationNextSection=919;  end;847begin  ParamTalk=Toy.Talk(PresentationPath+′gm847m.wav′,′S′);Synchronize(UpdatePresentationBar);  PresentationNextSection=850;  LoopCount=0;  end;850begin  //sensors1-Nose2-Hand3-Foot;0-none  ParamListen=Toy.Listen(″,DTime,′Sensor′,′W′);//nose  ifParamListen=NoseSensorthenPresentationNextSection=860  elsePresentationNextSection=855;  Synchronize(UpdatePresentationBar);  LoopCount=LoopCount+1;  if(LoopCount=3)and(PresentationNextSection=855)then  PresentationNextSection=860;  end;855begin  ParamTalk=Toy.Talk(PresentationPath+′gm855m.wav′,′S′);  Synchronize(UpdatePresentationBer);  PresentationNextSection=850;  end;860begin  ParamTalk=Toy.Talk(PresentationPath+′gm860.wav′,′S′);  Synchronize(UpdatePresentationBar);  PresentationNextSection=865;  end;865begin  ParamTalk=Toy.Talk(PresentationPath+′qm865m.wav′,′S′);  Synchronize(UpdatePresentationBar);  PresentationNextSection=870;  LoopCount=0;  end;870begin  //sensors1-Nose2-Hand3-Foot;0-none  ParamListen=Toy.Listeh(′′,DTime,′Sensor′,′W′);//foot  ifParamListen=FootSensorthenPresentationNextSection=890  elsePresentationNextSection=875;  Synchronize(UpdatePresentationBar);  LoopCount=LoopCount+1;  if(LoopCount=3)and(PresentationNextSection=875)thenPresentationNextSection=890;  end;875begin  ParamTalk=Toy.Talk(PresentationPath+′gm875m.wav′,′S′);  Synchronize(UpdatePresentationBar);  PresentationNextSection=870;  end;890begin  ParamTalk=Toy.Talk(PresentationPath+′gm890.wav′,′S′);  Synchronize(UpdatePresentationBar);  PresentationNextSection=895;  end;895begin  ParamTalk=Toy.Talk(PresentationPath+′gm895.wav′,′S′);  Synchronize(UpdatePresentationBar);  PresentationNextSection=900;  LoopCount=0;  end;900begin  //sensors1-Nose2-Hand3-Foot;0-none  ParamListen=Toy.Listen(″,DTime,′Sensor′,′W′);//hand  ifParamListen=HandSensorthenPresentationNextSection=910  elsePresentationNextSection=905;  Synchronize(UpdatePresentationBar);  LoopCount=LoopCount+1;  if(LoopCount=3)and(PresentationNextSection=905)then  PresentationNextSection=910;  end;905begin  ParamTalk=Toy.Talk(PresentationPath+′gm905m.wav′,′S′);  Synchronize(UpdatePresentationBar);  PresentationNextSection=900;  end;910begin  ParamTalk=Toy.Talk(PresentationPath+′gm910.wav′,′S′);  Synchronize(UpdatePresentationBar);  PresentationNextSection=915;end;915begin  ParamTalk=Toy.Talk(PresentationPath+′gm915.wav′,′S′);  Synchronize(UpdatePresentationBar);  PresentationNextSection=920;  Sensor1=0;  Sensor2=0;  Sensor3=0;  LoopCount=0;  end;919begin  PresentationNextSection=920;  Sensor1=0;  Sensor2=0;  Sensor3=0;  LoopCount=0;  end;920begin  //sensors1-Nose2-Hand3-Foot;0-none  LoopCount=LoopCount+1;  if(Sensor1=HandSensor)and(Sensor2=NoseSensor)and(Sensor3=FootSensor)then  PresentationNextSection=926//success  else  begin  PresentationNextSection=920;//looping  ifLoopCount>5then//pressingnotright  begin  PresentationNextSection=924;//timeout  if(Sensor1>0)or(Sensor2>0)or(Sensor3>0)then  PresentationNextSection=925;//pressnotright  end  else  begin  GetSensor=Toy.Listen(″,DTime,′Sensor′,′W′);  ifGetSensor>0then  begin  ifGetSensor=NoseSensorthenPresentationNextSection=921;//noseifGetSensor=HandSensorthenPresentationNextSection=923;//hand  ifGetSensor=FootSensorthenPresentationNextSection=922;//foot  Sensor1=Sensor2;  Sensor2=Sensor3;  Sensor3=GetSensor;  end;  if(Sensor1=0)and(Sensor2=0)and(Sensor3=0)//timeout  and(LoopCount=3)thenPresentationNextSection=925;  end;  end;  end;  921begin  ParamTalk=Toy.Talk(PresentationPath+′gm921.wav′,′S′);  Synchronize(UpdatePresentationBar);  PresentationNextSection=920;  end;  922begin  ParamTalk=Toy.Talk(PresentationPath+′gm922.wav′,′S′);  Synchronize(UpdatePresentationBar);  PresentationNextSection=920;  end;  923begin  ParamTalk=Toy.Talk(PresentationPath+′gm923.wav′,′S′);  Synchronize(UpdatePresentationBar);  PresentationNextSection=920;  end;  925begin  ParamTalk=Toy.Talk(PresentationPath+′gm925.wav′,′S′); Synchronize(UpdatePresentationBar);  PresentationNextSection=927;  end;  926begin  ParamTalk=Toy.Talk(PresentationPath+′gm926m.wav′,′S′);  Synchronize(UpdacePresentationBar);PresentationNextSection=1006;  end;927begin  //sensors1-Nose2-Hand3-Foot;0-none  PresentationNextSection=928;  Sensor1=Toy.Listen(″,7,′Sensor′,′W′);  ifSensor1=HandSensorthenToy.Talk(PresentationPath+′gm910.wav′,′S′);  ifSensor1=NoseSensorthenToy.Talk(PresentationPath+′gm860.wav′,′S′);  ifSensor1=FootSensorthenToy.Talk(PresentationPath+′gm890.wav′,′S′);  Sensor2=Toy.Listen(″,7,′Sensor′,′W′);  ifSensor2=HandSensorthenToy.Talk(PresentationPath+′gm910.wav′,′S′);  ifSensor2=NoseSensorthenToy.Talk(PresentationPath+′gm860.wav′,′S′);  ifSensor2=FootSensorthenToy.Talk(PresentationPath+′gm890.wav′,′S′);  Sensor3=Toy.Listen(″,7,′Sensor′,′W′);  ifSensor3=HandSensorthenToy.Talk(PresentationPath+′gm910.wav′,′S′);  ifSensor3=NoseSensorthenToy.Talk(PresentationPath+′gm860.wav′,′S′); ifSensor3=FootSensorthenToy.Talk(PresentationPath+′gm890.wav′,′S′);  if(Sensor1=HandSensor)and(Sensor2=NoseSensor)and(Sensor3=FootSensor)  thenPresentationNextSection=926  elsePresentationNextSection=928;  end;  928begin  ParamTalk=Toy.Talk(PresentationPath+′gm928.wav′,′S′);  Synchronize(UpdatePresentationBar);  PresentationNextSection=1005;  end;  932begin ParamTalk=Toy.Talk(PresentationPath+′gm932.wav′,′S#′);  Synchronize(UpdatePresentationBar);PresentationNextSection=936;  end;  933begin  ParamTalk=Toy.Talk(PresentationPath+′gm933n.wav′,′S′);  Synchronize(UpdatePresentationBar);  PresentationNextSection=1006;  end;  936begin  ParamListen=Toy.Listen(′yes/1,no/2′,DTime,′SR′,′W′);  caseParamListenof  1PresentationNextSection=840;  2PresentationNextSection=940;  elsePresentationNextSection=940;  end;  Synchronize(UpdatePresentationBar);  end;  940begin  ParamTalk=Toy.Talk(PresentationPath+′gm940n.wav′,′S#′); Synchronize(UPdatePresentationBar);  PresentationNextSection=941;  LoopCount=0;  end;  941begin  ParamListen=Toy.Listen(′story/1,song/2,storyteller/3′,DTime,′SR′,′W′);  caseParamListenof  1PresentationNextSection=100;//storymenu  2PresentationNextSection=300;//songmenu  3PresentationNextSection=300;//themesong  elsePresentationNextSection=945;  end;  Synchronize(UpdatePresentationBar);  LoopCount=LoopCount+1;  if(LoopCount=3)and(PresentationNextSection=945)then  PresentationNextSection=100;  end;  945begin  ParamTalk=Toy.Talk(PresentationPath+′gm940n.wav′,′S#′);Synchronize(UpdatePresentationBar);  PresentationNextSection=941;  end;  965begin  ParamTalk=Toy.Talk(PresentationPath+′gm965m.wav′,′S′);  Synchronize(UpdatePresentationBar);  PresentationNextSection=970;  end;  967begin  ParamTalk=Toy.Talk(PresentationPath+′gm967.wav′,′S′);  Synchronize(UpdatePresentationBar);  PresentationNextSection=970;  end; 970begin  ParamTalk=Toy.Talk(PresentationPath+′gm970.wav′,′S#′);  Synchronize(UpdatePresentationBar);  PresentationNextSection=971;  LoopCount=0;  end;  971begin  ParamListen=Toy.Listen(′lollipop/1,peanutbutter/2′,7,′SR′,′W′);  caseParamListenof  1PresentationNextSection=975;  2PresentationNextSection=980;  elsePresentationNextSection=972;  end;  LoopCount=LoopCount+1;  if(LoopCount=3)and(PresentationNextSection=972)then  PresentationNextSection=984;  Synchronize(UpdatePresentationBar);  end;  972begin ParamTalk=Toy.Talk(PresentationPath+′gm972.wav′,′S#′);  Synchronize(UpdatePresentationBar);  PresentationNextSection=971;  end;975begin  ParamTalk=Toy.Talk(PresentationPath+′gm975.wav′,′S′);  Synchronize(UpdatePresentationBar);  PresentationNextSection=984;  end;980begin  ParamTalk=Toy.Talk(PresentationPath+′gm980.wav′,′S′);  Synchronize(UpdatePresentationBar);  PresentationNextSection=984;  end;984begin  ParamTalk=Toy.Talk(PresentationPath+′gm984.wav′,′S′);  Synchronize(UpdatePresentationBar);  PresentationNextSection=983;  LoopCount=0;  end;983begin  ParamListen=Toy.Listen(′rabbit/1,bear/2′,DTime,′SR′,′W′);  caseParamListenof  1PresentationNextSection=985;  2PresentationNextSection=990;  elsePresentationNextSection=982;  end;  LoopCount=LoopCount+1;  if(LoopCount=3)and(PresentationNextSection=982)then  PresentationNextSection=005;  Synchronize(UpdatePresentationBar);  end;982begin  ParamTalk=Toy.Talk(PresentationPath+′gm982.wav′,′S#′);  Synchronize(UpdatePresentationBar);  PresentationNextSection=983;  end;985begin  ParamTalk=Toy.Talk(PresentationPath+′gm985m.wav′,′S′);  Synchronize(UpdatePresentationBar);  PresentationNextSection=932;  end;990begin  ParamTalk=Toy.Talk(PresentationPath+′gm990.wav′,′S′);  Synchronize(UpdatePresentationBar);  PresentationNextSection=932;  ifMainForm.ToyMachine=′TeddyBear′thenPresentationNextSection=1005;  end;1005begin ParamTalk=Toy.Talk(PresentationPath+′gm1005.wav′,′S′);  Synchronize(UpdatePresentationBar);  PresentationNextSection=1006;  end;1006begin  ParamTalk=Toy.Talk(PresentationPath+′gm1006.wav′,′S#′);  Synchronize(UpdatePresentationBar);  PresentationNextSection=998;  LoopCount=0;  end;998begin  ParamListen=Toy.Listen(′story/1,song/2,storyteller/3′,DTime,′SR′,′W′);  caseParamListenof  1PresentationNextSection=100;//storymenu  2PresentationNextSection=300;//songmenu  3PresentationNextSection=5000;//themesong  elsePresentationNextSection=997;  end;  LoopCount=LoopCount+1;  if(LoopCount=3)and(PresentationNextSection=997)then  PresentationNextSection=100;  Synchronize(UpdatePresentationBar);  end;997begin  ParamTalk=Toy.Talk(PresentationPath+′gm997.wav′,′S#′);  Synchronize(UpdatePresentationBar);  PresentationNextSection=998;  end//BunnyLong=============================2000begin  Synchronize(UpdatePresentationBar);  VisitBunnyLong=VisitBunnyLong+1;  PresentationNextSection=2280;  end;2280begin  ParamTalk=Toy.Talk(PresentationPath+′rb280m.wav′,′E′);  Synchronize(UpdatePresentationBar);  PresentationNextSection=2285;  end;2285begin  ParamTalk=Toy.Talk(PresentationPath+′rb286.wav′,′S′);  Synchronize(UpdatePresentationBar);  PresentationNextSection=2286;  end;2286begin  ParamTalk=Toy.Talk(PresentationPath+′rb287.wav′,′S′);  Synchronize(UpdatePresentationBar);  PresentationNextSection=2290;  end;2290begin  WaveSection=′rb2901′;  ifBunnyFavoriteFood=′Honey′thenWaveSection=′rb2901′;  ifBunnyFavoriteFood=′Peanut′thenWaveSection=′rb2902′;  ifBunnyFavoriteFood=′Marshmallow′thenWaveSection=′rb2903′;  ParamTalk=Toy.Talk(PresentationPath+WaveSection+′.wav′,′S′);  Synchronize(UpdatePresentationBar);  PresentationNextSection=2295;  end;2295begin  Synchronize(UpdatePresentationBar);  PresentationNextSection=2296;  end;2296begin  WaveSection=′rb2961′;  ifSecretName=′BubbleGum′thenWaveSection=′rb2961N′;ifSecretName=′Ace′thenWaveSection=′rb2962N′;  ifSecretName=′RainBow′thenWaveSection=′rb2963N′;  ParamTalk=Toy.Talk(PresentationPath+WaveSection+′,wav′,′S′);  Synchronize(UpdatePresentationBar);  PresentationNextSection=2300;  end;2297begin  ParamTalk=Toy.Talk(PresentationPath+′rb297m.wav′,′E′);  Synchronize(UpdatePresentationBar);  PresentationNextSection=2300;  end;2300begin  ParamTalk=Toy.Talk(PresentationPath+′rb300.wav′,′S′);  Synchronize(UpdatePresentationBar);  PresentationNextSection=2305;  end;2305begin  WaveSection=′rb3051′;  ifBunnyFavoriteFood=′Honey′thenWaveSection=′rb3051′;  ifBunnyFavoriteFood=′Peanut′thenWaveSection=′rb3052′;  ifBunnyFavoriteFood=′Marshmallow′thenWaveSection=′rb3053′;  ParamTalk=Toy.Talk(PresentationPath+WaveSection+′.wav′,′S′);  Synchronize(UpdatePresentationBar);  PresentationNextSection=2315;  end;2315begin  ParamTalk=Toy.Talk(PresentationPath+′rb315.wav′,′S′);  Synchronize(UpdatePresentationBar);  PresentationNextSection=2320;  end;2316begin  Synchronize(UpdatePresentationBar);  PresentationNextSection=2320;  end;2320begin  ParamTalk=Toy.Talk(PresentationPath+′rb320.wav′,′S′);  Synchronize(UpdatePresentationBar);PresentationNextSection=2330;  end;2330begin  ParamTalk=Toy.Talk(PresentationPath+′rb330.wav′,′S′);  Synchronize(UpdatePresentationBar);  PresentationNextSection=2335;  end;2335begin    ParamTalk=Toy.Talk(PresentationPath+′rb336.wav′,′S′);  Synchronize(UpdatePresentationBar);  PresentationNextSection=2336;  end;2336begin  ParamTalk=Toy.Talk(PresentationPath+′rb337.wav′,′S′);  Synchronize(UpdatePresentationBar);  PresentationNextSection=2344;  end;2344begin  ParamTalk=Toy.Talk(PresentationPath+′rb343.wav′,′S′);  Synchronize(UpdatePresentationBar);  PresentationNextSection=2345;  end;2345begin  ParamTalk=Toy.Talk(PresentationPath+′rb344.wav′,′S′);  Synchronize(UpdatePresentationBar);  PresentationNextSection=2346;  end;2346begin  ParamTalk=Toy.Talk(PresentationPath+′rb346m.wav′,′S′);  Synchronize(UpdatePresentationBar);  PresentationNextSection=2350;  end;2350begin  ParamTalk=Toy.Talk(PresentationPath+′rb351.wav′,′S′);  Synchronize(UpdatePresentationBar);  PresentationNextSection=351;end;2351begin  ParamTalk=Toy.Talk(PresentationPath+′rb352.wav′,′S′);  Synchronize(UpdatePresentationBar);  PresentationNextSection=2355;  end;2355begin  ParamTalk=Toy.Talk(PresentationPath+′rb356.wav′,′S′);  Synchronize(UpdatePresentationBar);  PresentationNextSection=2356;  end;2356begin  ParamTalk=Toy.Talk(PresentationPath+′rb357.wav′,′S′);  Synchronize(UpdatePresentationBar);  PresentationNextSection=2360;  end;2360begin  ParamTalk=Toy.Talk(PresentationPath+′rb360.wav′,′S′);  Synchronize(UpdatePresentationBar);  PresentationNextSection=2365;  end;2365begin  //sensors1-Nose2-Hand3-Foot;0-none  ParamListen=Toy.Listen(″,DTime,′Sensor′,′W′);  caseParamListenof  NoseSensorPresentationNextSection=2375;  HandSensorPresentationNextSection=2370;  FootSensorPresentationNextSection=2375;  else  PresentationNextSection=2385;  end;  Synchronize(UpdatePresentationBar);  end;2370begin  ParamTalk=Toy.Talk(PresentationPath+′rb370.wav′,′S′);  Synchronize(UpdatePresentationBar);  PresentationNextSection=2380;end;2375begin  ParamTalk=Toy.Talk(PresentationPath+′rb375.wav′,′S′);  Synchronize(UpdatePresentationBar);  PresentationNextSection=2365;  end;2380begin  //sensors1-Nose2-Hand3-Foot;0-none  ParamListen=Toy.Listen(″,DTime,′Sensor′,′W′);  caseParamListenof  NoseSensorPresentationNextSection=2385;  HandSensorPresentationNextSection=2382;  FootSensorPresentationNextSection=2385;  else  PresentationNextSection=2385;  end;  Synchronize(UpdatePresentationBar);  end;2382begin  ParamTalk=Toy.Talk(PresentationPath+′rb382.wav′,′S′);  Synchronize(UpdatePresentationBar);  PresentationNextSection=2385;  end;2385begin  ParamTalk=Toy.Talk(PresentationPath+′rb385.wav′,′S′);  Synchronize(UpdatePresentationBar);  PresentationNextSection=2386;  end;2386begin  ParamTalk=Toy.Talk(PresentationPath+′rb386.wav′,′E′);  Synchronize(UpdatePresentationBar);  PresentationNextSection=2390;  end;2390begin  ParamTalk=Toy.Talk(PresentationPath+′rb390.wav′,′S′);  Synchronize(UpdatePresentationBar);  PresentationNextSection=2395;end;2395begin  ParamTalk=Toy.Talk(PresentationPath+′rb395m.wav′,′S′);  Synchronize(UpdatePresentationBar);  PresentationNextSection=2410;  end;2400begin  ParamTalk=Toy.Talk(PresentationPath+′rb400m.wav′,′S′);  Synchronize(UpdatePresentationBar);  PresentationNextSection=2410;  end;2405begin  ParamTalk=Toy.Talk(PresentationPath+′rb405m.wav′,′S′);  Synchronize(UpdatePresentationBar);  PresentationNextSection=2410;  end;2410begin  ParamTalk=Toy.Talk(PresentationPath+′rb410m.wav′,′S′);  Synchronize(UpdatePresentationBar);  PresentationNextSection=2415;  end;2415begin  WaveSection=′rb4151m′;  ifBunnyFavoriteFood=′Honey′thenWaveSection=′rb4151m′;  ifBunnyFavoriteFood=′Peanut′thenWaveSection=′rb4152m′;  ifBunnyFavoriteFood=′Marshmallow′thenWaveSection=′rb4153m′;  ParamTalk=Toy.Talk(PresentationPath+WaveSection+′.wav′,′S′);  Synchronize(UpdatePresentationBar);  PresentationNextSection=2420;  end;2420begin  WaveSection=′rb4201′;  ifBunnyFavoriteFood=′Honey′thenWaveSection=′rb4201′;  ifBunnyFavoriteFood=′Peanut′thenWaveSection=′rb4202′;ifBunnyFavoriteFood=′Marshmallow′thenWaveSection=′rb4203′;  ParamTalk=Toy.Talk(PresentationPath+WaveSection+′.wav′,′S′);  Synchronize(UpdatePresentationBar);  PresentationNextSection=2425;  end;2425begin  ParamTalk=Toy.Talk(PresentationPath+′rb425m.wav′,′S′);  Synchronize(UpdatePresentationBar);  PresentationNextSection=2426;  end;2426begin  ParamTalk=Toy.Talk(PresentationPath+′rb426m.wav′,′EL′);  Synchronize(UpdatePresentationBar);  PresentationNextSection=2435;  end;2435begin  ParamTalk=Toy.Talk(PresentationPath+′rb435m.wav′,′S′);  Synchronize(UpdatePresentationBar);  PresentationNextSection=2440;  end;2440begin  ParamTalk=Toy.Talk(PresentationPath+′rb440.wav′,′S′);  Synchronize(UpdatePresentationBar);  PresentationNextSection=2445;  end;2445begin  ParamTalk=Toy.Talk(PresentationPath+′rb445m.wav′,′S′);  Synchronize(UpdatePresentationBar);  PresentationNextSection=245;  end;//EndofBunnyLong==============================//BunnyShort===============================3000begin  Synchronize(UpdatePresentationBar);  VisitBunnyShort=VisitBunnyShort+1;  PresentationNextSection=3005;  end;  3005begin  ParamTalk=Toy.Talk(PresentationPath+′rb3005m.wav′,′E′);  Synchronize(UpdatePresentationBar);  PresentationNextSection=3010;  end;  3010begin  ParamTalk=Toy.Talk(PresentationPath+′rb005m.wav′,′S′);  Synchronize(UpdatePresentationBar);  PresentationNextSection=3015;  end;  3015begin  ParamListen=Toy.Listen(′honey/1,peanutbutter/2,marshmallowfluff/3′,7,′SR′,′W′);  caseParamListenof  1PresentationNextSection=3035;  2PresentationNextSection=3040;  3PresentationNextSection=3045;  elsePresentationNextSection=3020;  end;  Synchronize(UpdatePresentationBar);  end;  3020begin  ParamTalk=Toy.Talk(PresentationPath+′rb015.wav′,′S#′);  Synchronize(UpdatePresentationBar);  PresentationNextSection=3025;  end;  3025begin  ParanmListen=Toy.Listen(′honey/1,peanutbutter/2,marshmallowfluff/3′,DTime,′SR′,′W′);  caseParamListenof  1PresentationNextSection=3035;  2PresentationNextSection=3040;  3PresentationNextSection=3045;  elsePresentationNextSection=3030;  end;  Synchronize(UpdatePresentationBar);  end;3030begin  BunnyFavoriteFood=′Honey′;  ParamTalk=Toy.Talk(PresentationPath+′rb026.wav′,′S′);  Synchronize(UpdatePresentationBar);  PresentationNextSection=3035;  end;  3035begin  BunnyFavoriteFood=′Honey′;  ParamTalk=Toy.Talk(PresentationPath+′rb0301.wav′,′S′);  Synchronize(UpdatePresentationBar);  PresentationNextSection=3050;  end;  3040begin  BunnyFavoriteFood=′Peanut′;  ParamTalk=Toy.Talk(PresentationPath+′rb0302.wav′,′S′);  Synchronize(UpdatePresentationBar);  PresentationNextSection=3050;  end;  3045begin  BunnyFavoriteFood=′Marshmallow′;  ParamTalk=Toy.Talk(PresentationPath+′rb0303.wav′,′S′);  Synchronize(UpdatePresentationBar);  PresentationNextSection=3050;  end;  3050begin  ParamTalk=Toy.Talk(PresentationPath+′rb3050m.wav′,′S′);  PresentationNextSection=3055;  ifBunnyFavoriteFood=′Honey′thenPresentationNextSection=3055;  ifBunnyFavoriteFood=′Peanut′thenPresentationNextSection=3060;  ifBunnyFavoriteFood=′Marshmallow′thenPresentationNextSection=3065;  Synchronize(UpdatePresentationBar);  end;  3055begin  ParamTalk=Toy.Talk(PresentationPath+′rb3055.wav′,′S′);  Synchronize(UpdatePresentationBar);PresentationNextSection=3075;  end;3060begin  ParamTalk=Toy.Talk(PresentationPath+′rb3060.wav′,′S′);  Synchronize(UpdatePresentationBar);  PresentationNextSection=3075;  end;3065begin  ParamTalk=Toy.Talk(PresentationPath+′rb3065.wav′,′S′);  Synchronize(UpdatePresentationBar);  PresentationNextSection=3075;  end;3075begin  ParamTalk=Toy.Talk(PresentationPath+′rb3075n.wav′,′S′);  Synchronize(UpdatePresentationBar);  PresentationNextSection=3080;  end;3080begin  ParamTalk=Toy.Talk(PresentationPath+′rb110.wav′,′S#′);  Synchronize(UpdatePresentationBar);  PresentationNextSection=3085;  end;3085begin  ParamListen=Toy.Listen(′giraffe/1,elephant/2,bunny/3′,7,′SR′,′W′);  caseParamListenof  1PresentationNextSection=3095;  2PresentationNextSection=3090;  3PresentationNextSection=3100;  elsePresentationNextSection=3100;  end;  Synchronize(UpdatePresentationBar);  end;3090begin  ParamTalk=Toy.Talk(PresentationPath+′rb120.wav′,′S′);  Synchronize(UpdatePresentationBar);  PresentationNextSection=3125;end;3095begin  ParamTalk=Toy.Talk(PresentationPath+′rb125.wav′,′S′);  Synchronize(UpdatePresentationBar);  PresentationNextSection=3125;  end;3100begin  ParamTalk=Toy.Talk(PresentationPath+′rb130.wav′,′S′);  Synchronize(UpdatePresentationBar);  PresentationNextSection=3125;  end;3125begin  ParamTalk=Toy.Talk(PresentationPath+′rb220n.wav′,′S′);  Synchronize(UpdatePresentationBar);  PresentationNextSection=3135;  end;3135begin  ParamTalk=Toy.Talk(PresentationPath+′rb231m.wav′,′EL′);  Synchronize(UpdatePresentationBar);  PresentationNextSection=3140;  end;3140begin  ParamTalk=Toy.Talk(PresentationPath+′rb235n.wav′,′S#′);  Synchronize(UpdatePresentationBar);  PresentationNextSection=3145;  end;3145begin  ParamListen=Toy.Listen(′bunnythree/1′,DTime,′SR′,′W′);  caseParamListenof  1PresentationNextSection=3150;  elsePresentationNextSection=3155;  end;  Synchronize(UpdatePresentationBar);  end;3150begin  ParamTalk=Toy.Talk(PresentationPath+′rb245.wav′,′S′);PresentationNextSection=3160;  ifBunnyFavoriteFood=′Honey′thenPresentationNextSection=3160;  ifBunnyFavoriteFood=′Peanut′thenPresentationNextSeotion=3165;  ifBunnyFavoriteFood=′Marshmallow′thenPresentationNextSection=3170;  Synchronize(UpdatePresentationBar);  end;  3155begin  ParamTalk=Toy.Talk(PresentationPath+′rb3155.wav′,′S′);  PresentationNextSection=3160;  ifBunnyFavoriteFood=′Honey′thenPresentationNextSection=3160;  ifBunnyFavoriteFood=′Peanut′thenPresentationNextSection=3165;  ifBunnyFavoriteFood=′Marshmallow′thenPresentationNextSection=3170;  Synchronize(UpdatePresentationBar);  end;  3160begin  ParamTalk=Toy.Talk(PresentationPath+′rb3160.wav′,′S′);  Synchronize(UpdatePresentationBar);  PresentationNextSection=3180;  end;  3165begin  ParamTalk=Toy.Talk(PresentationPath+′rb3165.wav′,′S′);  Synchronize(UpdatePresentationBar);  PresentationNextSection=3185;  end;  3170begin  ParamTalk=Toy.Talk(PresentationPath+′rb3170.wav′,′S′);  Synchronize(UpdatePresentationBar);  PresentationNextSection=3190;  end;  3180begin  ParamTalk=Toy.Talk(PresentationPath+′rb2751.wav′,′S′);  Synchronize(UpdatePresentationBar);PresentationNextSection=3195;  end;3185begin  ParamTalk=Toy.Talk(PresentationPath+′rb2752.wav′,′S′);  Synchronize(UpdatePresentationBar);  PresentationNextSection=3195;  end;3190begin  ParamTalk=Toy.Talk(PresentationPath+′rb2753.wav′,′S′);  Synchronize(UpdatePresentationBar);  PresentationNextSection=3195;  end;3195begin  ParamTalk=Toy.Talk(PresentationPath+′rb280m.wav′,′E′);  Synchronize(UpdatePresentationBar);  PresentationNextSection=205;  end;//EndofBunnyShort=============================//PrincessandThePea==========================4000begin  VisitPrincess=Visitprincess+1;  PresentationNextSection=-1;  PrincessNextSection=1;  end;4010begin  PresentationNextSection=699;//gobackfromprincess  end;//EndofPrincessandThePea========================//ThemeSong================================5000begin  PresentationNextSection=5010;  end;5010begin  ParamTalk=Toy.TalkAll(Path+′StoryTeller.wav′,′S′);  Synchronize(UpdatePresentationBar);  PresentationNextSection=5020;end;  5020begin  //ParamTalk=Toy.Talk(Path+′Alonel.wav′,′S′);  Synchronize(UpdatePresentationBar);  PresentationNextSection=5030;  end;  5030begin  //ParamTalk=Toy.TalkAll(Path+′All.wav′,′S′);  Synchronize(UpdatePresentationBar);  PresentationNextSection=5040;  end;5040begin    //ParamTalk=Toy.Talk(Path+′Alone2.wav′,′S′);  Synchronize(UpdatePresentationBar);  PresentationNextSection=5050;  end;5050begin  //ParamTalk=Toy.TalkAll(Path+′All.wav′,′S′);  Synchronize(UpdatePresentationBar);  PresentationNextSection=5060;  end;5060begin  //ParamTalk=Toy.Talk(Path+′Alone3.wav′,′S′);  Synchronize(UpdatePresentationBar);  PresentationNextSection=45;  ifSecretName=′BubbleGum′thenPresentationNextSection=50;  ifSecretName=′Ace′thenPresentationNextSection=40;  ifSecretName=′Rainbow′thenPresentationNextSection=45;  end;//EndofThemeSong============================//PAUSE10000begin  PresentationNextSection=10000;  sleep(200);  end;end//EndofPresentationif(PresentationNextSection<>699)and(PresentationNextSection<>10000)  and(PresentationNextSection<>760)and(PresentationNextSection<>750)then  LastPresentation=PresentationNextSection;{*//========INTRO====================//------------writehereallsessions---------------------------------------//=====================================  caseIntroNextSectionof  1begin  //Toy.Wait(12,′W′);  {sleep(300);  ParamTalk=Toy.Talk(IntroPath+′in001.wav′,′E′);  ParamListen=Toy.Listen(′yes/1,no,2′,1.5,′SRandSensor′);  StatusForm.StatusGauge.Progress=IntroNextSection/4.5;}  IntroNextSection=5;  end;  2begin  {ParamTalk=Toy.Talk(IntroPath+′in01a.wav′,′E′);  Synchronize(UpdateIntroBar);  IntroNextSection=3;}  end;  3begin  {ParamTalk=Toy.Talk(IntroPath+′in01b.wav′,′EL′);  Synchronize(UpdateIntroBar);  IntroNextSection=5;}  end;  4begin  {sleep(300);  Synchronize(UpdateIntroBar);  IntroNextSection=5;}  end;  5begin  ParamTalk=Toy.Talk(IntroPath+′in01.wav′,′S′);  Synchronize(UpdateIntroBar);  IntroNextSection=10;end;6begin  {sleep(300);  Synchronize(UpdateIntroBar);  IntroNextSection=7;}  end;7begin  {sleep(300);  Synchronize(UpdateIntroBar);  IntroNextSection=8;}  end;8begin  {sleep(300);  Synchronize(UpdateIntroBar);  IntroNextSection=9;}  end;9begin  {sleep(300);  Synchronize(UpdateIntroBar);  IntroNextSection=10;}  end;10begin  ParamTalk=Toy.Talk(IntroPath+′in02m.wav′,′SP1′);  Synchronize(UpdateIntroBar);  IntroNextSection=21;  ifSecretName=′Bubblegum′thenIntroNextSection=21;  ifSecretName=′Ace′thenIntroNextSection=22;  ifSecretName=′Rainbow′thenIntroNextSection=23;  end;11begin  {sleep(300);  Synchronize(UpdateIntroBar);  IntroNextSection=12;}  end;12begin  {sleep(300);Synchronize(UpdateIntroBar);  IntroNextSection=13;}  end;13begin  {sleep(300);  Synchronize(UpdateIntroBar);  IntroNextSection=14;}  end;14begin  {sleep(300);  Synchronize(UpdateIntroBar);  IntroNextSection=15;}  end;15begin  {ParamTalk=Toy.Talk(IntroPath+′in02b.wav′,′S′);  Synchronize(UpdateIntroBar);  IntroNextSection=16;}  end;16begin  {ParamTalk=Toy.Talk(IntroPath+′in02c.wav′,′E′);  Synchronize(UpdateIntroBar);  IntroNextSection=20;}  end;17begin  {ParamTalk=Toy.Talk(IntroPath+′in02c.wav′,′E′);  Synchronize(UpdateIntroBar);  IntroNextSection=18;}  end;18begin  {sleep(300);  Synchronize(UpdateIntroBar);  IntroNextSection=19;}  end;19begin  {sleep(300);  Synchronize(UpdateIntroBar);IntroNextSection=20;)  end;20begin  {ParamTalk=Toy.Talk(IntroPath+′in02.wav′,′S′);  Synchronize(UpdateIntroBar);  IntroNextSection=21;  ifSecretName=′Bubblegum′thenIntroNextSection=21;  ifSecretName=′Ace′thenIntroNextSection=22;  ifSecretName=′Rainbow′thenIntroNextSection=23;}  end;21begin  ParamTalk=Toy.Talk(IntroPath+′in03.way′,′S′);  Synchronize(UpdateIntroBar);  IntroNextSection=30;  end;22begin  ParamTalk=Toy.Talk(IntroPath+′in03a.wav′,′S′);  Synchronize(UpdateIntroBar);  IntroNextSection=30;  end;23begin  ParamTalk=Toy.Talk(IntroPath+′in03b.wav′,′S′);  Synchronize(UpdateIntroBar);  IntroNextSection=30;  end;24begin  {sleep(300);  Synchronize(UpdateIntroBar);  IntroNextSection=25;}  end;25begin  {sleep(300);  Synchronize(UpdateIntroBar);  IntroNextSection=26;}  end;26begin{sleep(300);  Synchronize(UpdateIntroBar);  IntroNextSection=27;}  end;27begin  {sleep(300);  Synchronize(UpdateIntroBar);  IntroNextSection=28;}  end;28begin  {sleep(300);  Synchronize(UpdateIntroBar);  IntroNextSection=29;}  end;29begin  {sleep(300);  Synchronize(UpdateIntroBar);  IntroNextSection=30;}  end;30begin  ParamTalk=Toy.Talk(IntroPath+′in04.wav′,′S′);  Synchronize(UpdateIntroBar);  IntroNextSection=35;  end;31begin  {ParamTalk=Toy.Talk(IntroPath+′in04a.wav′,′EL′);  Synchronize(UpdateIntroBar);  IntroNextSection=35;}  end;32begin  {sleep(300);  Synchronize(UpdateIntroBar);  IntroNextSection=33;}  end;33begin  {sleep(300);Synchronize(UpdateIntroBar);  IntroNextSection=34;}  end;34begin  {sleep(300);  Synchronize(UpdateIntroBar);  IntroNextSection=35;}  end;35begin  ParamTalk=Toy.Talk(IntroPath+′in05m.wav′,′SP2′);  Synchronize(UpdateIntroBar);  IntroNextSection=45;  end;36begin  {sleep(300);  Synchronize(UpdateIntroBar);  IntroNextSection=37;}  end;37begin  {sleep(300);  Synchronize(UpdateIntroBar);  IntroNextSection=38;}  end;38begin  {sleep(300);  Synchronize(UpdateIntroBar);  IntroNextSection=39;}  end;39begin  {sleep(300);  Synchronize(UpdateIntroBar);  IntroNextSection=40;}  end;40begin  {ParamTalk=Toy.Talk(IntroPath+′in05.wav′,′S′);  Synchronize(UpdateIntroBar);IntroNextSection=45;}  end;41begin  {sleep(300);  Synchronize(UpdateIntroBar);  IntroNextSection=42;}  end;42begin  {sleep(300);  Synchronize(UpdateIntroBar);  IntroNextSection=43;}  end;43begin  {sleep(300);  Synchronize(UpdateIntroBar);  IntroNextSection=44;}  end;44begin  {sleep(300);  Synchronize(UpdateIntroBar);  IntroNextSection=45;}  end;45begin  ParamTalk=Toy.Talk(IntroPath+′in06.wav′,′S′);  Synchronize(UpdateIntroBar);  IntroNextSection=50;  end;46begin  {sleep(300);  Synchronize(UpdateIntroBar);  IntroNextSection=47;}  end;47begin{sleep(300);Synchronize(UpdateIntroBar);IntroNextSection=48;}end;48begin  {sleep(300);  Synchronize(UpdateIntroBar);  IntroNextSection=49;}  end;49begin  {sleep(300);  Synchronize(UpdateIntroBar);  IntroNextSection=50;}  end;50begin  ParamTalk=Toy.Talk(IntroPath+′in07.wav′,′S′);  Synchronize(UpdateIntroBar);  IntroNextSection=55;  end;51begin  {sleep(300);  Synchronize(UpdateIntroBar);  IntroNextSection=52;}  end;52begin  {sleep(300);  Synchronize(UpdateIntroBar);  IntroNextSection=53;}  end;53begin  {sleep(300);  Synchronize(UpdateIntroBar);  IntroNextSection=54;}  end;54begin  {sleep(300);  Synchronize(UpdateIntroBar);  IntroNextSection=55;}  end;55begin  ParamListen=Toy.Wait(12,′W′);  ifParamListen=1thenIntroNextSection=60  elseIntroNextSection=65;  Synchronize(UpdateIntroBar);  end;56begin  {sleep(300);  Synchronize(UpdateIntroBar);  IntroNextSection=57;}  end;57begin  {sleep(300);  Synchronize(UpdateIntroBar);  IntroNextSection=58;}  end;58begin  {sleep(300);  Synchronize(UpdateIntroBar);  IntroNextSection=59;}  end;59begin  {sleep(300);  Synchronize(UpdateIntroBar);  IntroNextSection=60;}  end;60begin  ParamTalk=Toy.Talk(IntroPath+′in09.wav′,′S′);  Synchronize(UpdateIntroBar);  IntroNextSection=67;  end;61begin  {sleep(300);  Synchronize(UpdateIntroBar);  IntroNextSection=62;}  end;62begin  {sleep(300);  Synchronize(UpdateIntroBar);  IntroNextSection=63;}  end;63begin  {sleep(300);  Synchronize(UpdateIntroBar);  IntroNextSection=64;}  end;64begin  {sleep(300);  Synchronize(UpdateIntroBar);  IntroNextSection=65;}  end;65begin  ParamTalk=Toy.Talk(IntroPath+′in10.wav′,′S′);  ifParamTalk=1thenIntroNextSection=60  elseIntroNextSection=66;  Synchronize(UpdateIntroBar);  end;66begin  ParamListen=Toy.Wait(12,′W′);  ifParamListen=1thenIntroNextSection=60  elseIntroNextSection=67;  Synchronize(UpdateIntroBar);  end;67begin  ParamTalk=Toy.Talk(IntroPath+′******.wav′,′S′);  Synchronize(UpdateIntroBar);  IntroNextSection=70;  end;68begin  {sleep(300);  Synchronize(UpdateIntroBar);  IntroNextSection=69;}end;69begin  {sleep(300);  Synchronize(UpdateIntroBar);  IntroNextSection=70;}  end;70begin  ParamTalk=Toy.Talk(IntroPath+′in10b.wav′,′S′);  Synchronize(UpdateIntroBar);  IntroNextSection=71;  ifSecretName=′Bubblegum′thenIntroNextSection=71;  ifSecretName=′Ace′thenIntroNextSection=72;  ifSecretName=′Rainbow′thenIntroNextSection=73;  end;71begin  ParamTalk=Toy.Talk(IntroPath+′in11.wav′,′S′);  Synchronize(UpdateIntroBar);  IntroNextSection=80;  end;72begin  ParamTalk=Toy.Talk(IntroPath+′in11a.wav′,′S′);  Synchronize(UpdateIntroBar);  IntroNextSection=80;  end;73begin  ParamTalk=Toy.Talk(IntroPath+′in11b.wav′,′S′);  Synchronize(UpdateIntroBar);  IntroNextSection=80;  end;74begin  {sleep(300);  Synchronize(UpdateIntroBar);  IntroNextSection=75;}  end;75begin  {sleep(300);Synchronize(UpdateIntroBar);  IntroNextSection=76;}  end;76begin  {sleep(300);  Synchronize(UpdateIntroBar);  IntroNextSection=77;}  end;77begin  {sleep(300);  Synchronize(UpdateIntroBar);  IntroNextSection=78;}  end;78begin  {sleep(300);  Synchronize(UpdateIntroBar);  IntroNextSection=79;}  end;79begin  {sleep(300);  Synchronize(UpdateIntroBar);  IntroNextSection=80;}  end;80begin  ParamTalk=Toy.Talk(IntroPath+′in11m.wav′,′S′);  Synchronize(UpdateIntroBar);  IntroNextSection=85;  end;81begin  {ParamTalk=Toy.Talk(IntroPath+′in12.wav′,′S′);  Synchronize(UpdateIntroBar);  IntroNextSection=85;}  end;82begin  {sleep(300);  Synchronize(UpdateIntroBar);IntroNextSection=83;}  end;83begin  {sleep(300);  Synchronize(UpdateIntroBar);  IntroNextSection=84;}  end;84begin  {sleep(300);  Synchronize(UpdateIntroBar);  IntroNextSection=85;}  end;85begin  ParamTalk=Toy.Talk(IntroPath+′in12.wav′,′EL′  Synchronize(UpdateIntroBar);  IntroNextSection=86;  end;86begin  ParamTalk=Toy.Talk(IntroPath+′in12b.wav′,′S′);  Synchronize(UpdateIntroBar);  IntroNextSection=90;  end;87begin  {sleep(300);  Synchronize(UpdateIntroBar);  IntroNextSection=88;}  end;88begin  {sleep(300);  Synchronize(UpdateIntroBar);  IntroNextSection=89;}  end;89begin  {sleep(300);  Synchronize(UpdateIntroBar);  IntroNextSection=90;}end;  90begin  ParamTalk=Toy.Talk(IntroPath+′in13.wav′,′S′);  Synchronize(UpdateIntroBar);  IntroNextSection=95;  end;  95begin  ParamTalk=Toy.Talk(IntroPath+′in13a.wav′,′S′);//randomizeWAVE  Synchronize(UpdateIntroBar);  IntroNextSection=100;  end;  100begin  ParamTalk=Toy.Talk(IntroPath+′in14.wav′,′S′);  Synchronize(UpdateIntroBar);  IntroNextSection=110;  end;  110begin  ParamListen=Toy.Wait(12,′W′);  ifParamListen=3thenIntroNextSection=120  elseIntroNextSection=115;  Synchronize(UpdateIntroBar);  end;  115begin  ParamTalk=Toy.Talk(IntroPath+′in14a.wav′,′S′);  ifParamTalk=3thenIntroNextSection=120  elseIntroNextSection=116;  Synchronize(UpdateIntroBar);  end;  116begin  ParamListen=Toy.Wait(12,′W′);  ifParamListen=3thenIntroNextSection=120  elseIntroNextSection=145;  Synchronize(UpdateIntroBar);  end;  120beginParamTalk=Toy.Talk(IntroPath+′in13a.wav′,′S′);//randomizeWAVE  Synchronize(UpdateIntroBar);  IntroNextSection=145;  end;  145begin  ParamTalk=Toy.Talk(IntroPath+′in1S.wav′,′S′);  Synchronize(UpdateIntroBar);  IntroNextSection=155;  end;    155begin  ParamTalk=Toy.Talk(IntroPath+′in16.wav′,′S′);  Synchronize(UpdateIntroBar);  IntroNextSection=160;  ifSecretName=′Bubblegum′thenIntroNextSection=160;  ifSecretName=′Ace′thenIntroNextSection=161;  ifSecretName=′Rainbow′thenIntroNextSection=162;  end;  160begin  ParamTalk=Toy.Talk(IntroPath+′in17.wav′,′S′);  Synchronize(UpdateIntroBar);  IntroNextSection=164;  end;  161begin  ParamTalk=Toy.Talk(IntroPath+′in17a.wav′,′S′);  Synchronize(UpdateIntroBar);  IntroNextSection=164;  end;  162begin  ParamTalk=Toy.Talk(IntroPath+′in17b.wav′,′S′);  Synchronize(UpdateIntroBar);  IntroNextSection=164;  end;  164begin  ParamTalk=Toy.Talk(IntroPath+′in18.wav′,′S′);  Synchronize(UpdateIntroBar);  IntroNextSection=165;end;  165begin  ParamTalk=Toy.Talk(IntroPath+′SPin165.wav′,′SP3′);  Synchronize(UpdateIntroBar);  IntroNextSection=175;  end;  166begin  {ParamTalk=Toy.Talk(IntroPath+′in20.wav′,′S′);  Synchronize(UpdateIntroBar);  IntroNextSection=167;}  end;  167begin  {ParamTalk=Toy.Talk(IntroPath+′inbeep.wav′,′EL′);  Synchronize(UpdateIntroBar);  IntroNextSection=168;}  end;  168begin  {ParamTalk=Toy.Talk(IntroPath+′in19.wav′,′S′);  Synchronize(UpdateIntroBar);  IntroNextSection=169;}  end;  169begin  {ParamTalk=Toy.Talk(IntroPath+′inblerp.wav′,′EC′);  Synchronize(UpdateIntroBar);  IntroNextSection=170;}  end;  170begin  {ParamTalk=Toy.Talk(IntroPath+′in21.wav+′+IntroPath+′in22.wav′,′S′);  Synchronize(UpdatefntroBar);  IntroNextSection=171;}  end;  171begin  {ParamTalk=Toy.Talk(IntroPath+′inboop.wav′,′E′);  Synchronize(UpdateIntroBar);  IntroNextSection=172;}end;  172begin  {ParamTalk=Toy.Talk(IntroPath+′in26.wav′,′S′);  Synchronize(UpdateIntroBar);  IntroNextSection=175;}  end;  173begin  {ParamTalk=Toy.Talk(IntroPath+′in23.wav′,′S′);  Synchronize(UpdateIntroBar);  IntroNextSection=175;}  end;  175begin  ParamListen=Toy.Wait(12,′W′);  ifParamListen=1thenIntroNextSection=180  elseIntroNextSection=185;  Synchronize(UpdateIntroBar);  end;  180begin  ParamTalk=Toy.Talk(IntroPath+′in24.wav′,′S′);  Synchronize(UpdateIntroBar);  IntroNextSection=195;  end;  181begin  {ParamTalk=Toy.Talk(IntroPath+′inbeep.wav′,′EL′);//*****check???  ifParamTalk=2thenIntroNextSection=185  elseIntroNextSection=182;  Synchronize(UpdateIntroBar);}  end;  182begin  {ParamTalk=Toy.Talk(IntroPath+′in25b.wav′,′S′);//*****check???  ifParamTalk=2thenIntroNextSection=185  elseIntroNextSection=184;  Synchronize(UpdateIntroBar);}  end;184begin  {ParamListen=Toy.Listen(″,10,′Sensor′);  ifParamListen=2thenIntroNextSection=185  elseIntroNextSection=190;  Synchronize(UpdateIntroBar);}  end;185begin  ParamTalk=Toy.Talk(IntroPath+′SPin185.wav′,′SP4′);  ifParamTalk=1thenIntroNextSection=180  elseIntroNextSection=190;  Synchronize(UpdateIntroBar);  end;186begin  {ParamTalk=Toy.Talk(IntroPath+′inboop.wav′,′E′);  ifParamTalk=1thenIntroNextSection=180  elseIntroNextSection=187;  Synchronize(UpdateIntroBar);}  end;187begin  {ParamTalk=Toy.Talk(IntroPath+′in29b.wav′,′S′);  ifParamTalk=1thenIntroNextSection=180  elseIntroNextSection=190;  Synchronize(UpdateIntroBar);}  end;190begin  ParamListen=Toy.Wait(12,′W′);  ifParamListen=1thenIntroNextSection=180  elseIntroNextSection=195;  Synchronize(UpdateIntroBar);  end;195begin   ParamTalk=Toy.Talk(IntroPath+′SPin195.wav′,′SP5′);  Synchronize(UpdateIntroBar);  IntroNextSection=197;  end;196begin  {ParamTalk=Toy.Talk(IntroPath+′in23.wav′,′S′);Synchronize(UpdateIntroBar);  IntroNextSection=197;}  end;197begin  ParamListen=Toy.Wait(12,′W′);  ifParamListen=2thenIntroNextSection=200  elseIntroNextSection=205;  Synchronize(UpdateIntroBar);  end;200begin  ParamTalk=Toy.Talk(IntroPath+′in33.wav′,′S′);  Synchronize(UpdateIntroBar);  IntroNextSection=215;  end;205begin  ParamTalk=Toy.Talk(IntroPath+′SPin205.wav′,′SP6′);  ifParamTalk=2thenIntroNextSection=200  elseIntroNextSection=210;  Synchronize(UpdateIntroBar);  end;206begin  {ParamTalk=To.Talk(IntroPath+′inbeep.wav′,′S′);  ifParamTalk=2thenIntroNextSection=200  elseIntroNextSection=207;  Synchronize(UpdateIntroBar);}  end;207begin  {ParamTalk=Toy.Talk(IntroPath+′in34b.wav′,′S′);  ifParamTalk=2thenIntroNextSection=200  elseIntroNextSection=210;  Synchronize(UpdateIntroBar);}  end;210begin  ParamListen=Toy.Wait(12,′W′);  ifParamListen=2thenIntroNextSection=200  elseIntroNextSection=215;  Synchronize(UpdateIntroBar);end;215begin  ParamTalk=Toy.Talk(IntroPath+′SPin215.wav′,′SP7′);  Synchronize(UpdateIntroBar);  IntroNextSection=217;  end;216begin  {ParamTalk=Toy.Talk(IntroPath+′in30.wav′,′S′);  Synchronize(UpdateIntroBar);  IntroNextSection=217;}  end;217begin  ParamListen=Toy.Wait(12,′W′);   ifParamListen=3thenIntroNextSection=220  elseIntroNextSection=221;  Synchronize(UpdateIntroBar);  end;220begin  ParamTalk=Toy.Talk(IntroPath+′in36.wav′,′S′);  Synchronize(UpdateIntroBar);  IntroNextSection=230;  end;221begin  ParamTalk=Toy.Talk(IntroPath+′SPin221.wav′,′SP8′);  ifParamTalk=3thenIntroNextSection=220  elseIntroNextSection=224;  Synchronize(UpdateIntroBar);  end;222begin  {ParamTalk=Toy.Talk(IntroPath+′inblerp.wav′,′EC′);  Synchronize(UpdateIntroBar);  IntroNextSection=90;}  end;223begin  {ParamTalk=Toy.Talk(IntroPath+′in37b.wav′,′S′);  Synchronize(UpdateIntroBar);IntroNextSection=190;}  end;224begin  ParamTalk=Toy.Wait(12,′W′);  ifParamTalk=3thenIntroNextSection=220  elseIntroNextSection=230;  Synchronize(UpdateIntroBar);  end;230begin  ParamTalk=Toy.Talk(IntroPath+′in38.wav′,′S′);  Synchronize(UpdateIntroBar);  IntroNextSection=235;  end;235begin  ParamTalk=Toy.Talk(IntroPath+′SPin235.wav′,′SP9′);  ifParamTalk=1thenIntroNextSection=250  elseIntroNextSection=241;  Synchronize(UpdateIntroBar);  end;241begin  ParamTalk=Toy.Talk(IntroPath+′in40a.wav′,′S′);  Synchronize(UpdateIntroBar);  IntroNextSection=242;  end;242begin  ParamTalk=Toy.Talk(IntroPath+′SPin242.wav′,′SP10′);  Synchronize(UpdateIntroBar);  IntroNextSection=248;  end;243begin  {ParamTalk=Toy.Talk(IntroPath+′in12b.wav′,′S′);  Synchronize(UpdateIntroBar);  IntroNextSection=90;}  end;244begin  {ParamTalk=Toy.Talk(IntroPath+′in12b.wav′,′S′);Synchronize(UpdateIntroBar);  IntroNextSection=90;}  end;245begin  (ParamTalk=Toy.Talk(IntroPath+′in12b.wav′,′S′);  Synchronize(UpdateIntroBar);  IntroNextSection=90;}  end;246begin  {ParamTalk=Toy.Talk(IntroPath+′in12b.wav′,′S′);  Synchronize(UpdateIntroBar);  IntroNextSection=90;}  end;247begin  {ParamTalk=Toy.Talk(IntroPath+′in24.wav′,′S′);  Synchronize(UpdateIntroBar);  IntroNextSection=190;}  end;248begin  ParamTalk=Toy.Talk(IntroPath+′SPin235.wav′,′SP9′);  ifParamTalk=1thenIntroNextSection=250  elseIntroNextSection=270;  Synchronize(UpdateIntroBar);  end;250begin  ParamTalk=Toy.Talk(IntroPath+′in39.wav′,′S′);  Synchronize(UpdateIntroBar);  IntroNextSection=265;  end;265begin  ParamTalk=Toy.Talk(IntroPath+′in41.wav′,′S′);  Synchronize(UpdateIntroBar);  IntroNextSection=270;  end;270begin  ParamTalk=Toy.Talk(IntroPath+′in41m.wav′,′EL′);Synchronize(UpdateIntroBar);  IntroNextSection=275;  end;  275begin  ParamTalk=Toy.Talk(IntroPath+′in44.wav′,′S′);  Synchronize(UpdateIntroBar);  IntroNextSection=295;  end;  276begin  {ParamTalk=Toy.Talk(IntroPath+′in44c.wav′,′E′);  Synchronize(UpdateIntroBar);  IntroNextSection=277;}  end;  277begin  {ParamTalk=Toy.Talk(IntroPath+′in44b.wav′,′S′);  Synchronize(UpdateIntroBar);  IntroNextSection=285;}  end;  285begin  {ParamTalk=Toy.Talk(″,′EC′);//sleep(1000)wait1sec???  Synchronize(UpdateIntroBar);  IntroNextSection=300;}  end;  290begin  {ParamTalk=Toy.Talk(IntroPath+′in12b.wav′,′S′);//??????  Synchronize(UpdateIntroBar);  IntroNextSection=90;}  end;  295begin  ParamTalk=Toy.Talk(IntroPath+′in49.wav′,′S′);  Synchronize(UpdateIntroBar);  IntroNextSection=300;  end;  300beginParamTalk=Toy.Talk(IntroPath+′in50.wav′,′S′);  Synchronize(UpdateIntroBar);  IntroNextSection=305;  end;305begin  ParamListen=Toy.Listen(′toohot/7′,12,′SR′,′W′);  ifParamListen=7thenIntroNextSection=315  elseIntroNextSection=310;  Synchronize(UpdateIntroBar);  end;310begin  ParamTalk=Toy.Talk(IntroPath+′in52.wav′,′S′);  Synchronize(UpdateIntroBar);  IntroNextSection=311;  end;311begin  ParamListen=Toy.Listen(′toohot/7′,12,′SR′,′W′);  ifParamListen=7thenIntroNextSection=315  elseIntroNextSection=320;  Synchronize(UpdateIntroBar);  end;315begin  ParamTalk=Toy.Talk(IntroPath+′in52m.wav′,′EL′);  Synchronize(UpdateIntroBar);  IntroNextSection=316;  end;316begin  ParamTalk=Toy.Talk(IntroPath+′in51.wav′,′S′);  Synchronize(UpdateIntroBar);  IntroNextSection=320;  end;320begin  ParamTalk=Toy.Talk(IntroPath+′in53.wav′,′S′);  Synchronize(UpdateIntroBar);  IntroNextSection=325;  end;325begin  ParamListen=Toy.Listen(′toocold/7′,12,′SR′,′W′);  ifParamListen=7thenIntroNextSection=335  elseIntroNextSection=331;  Synchronize(UpdateIntroBar);  end;330begin  ParamTalk=Toy.Talk(IntroPath+′in55.wav′,′S′);  Synchronize(UpdateIntroBar);  IntroNextSection=331;  end;331begin  ParamListen=Toy.Listen(′toocold/7′,12,′SR′,′W′);  ifParamListen=7thenIntroNextSection=335  elseIntroNextSection=340;  Synchronize(UpdateIntroBar);  end;335begin  ParamTalk=Toy.Talk(IntroPath+′in55m.wav′,′E′);  Synchronize(UpdateIntroBar;  IntroNextSection=336;  end;336begin  ParamTalk=Toy.Talk(IntroPath+′in54.wav′,′S′);  Synchronize(UpdateIntroBar);  IntroNextSection=340;  end;340begin  ParamTalk=Toy.Talk(IntroPath+′in56.wav′,′S′);  Synchronize(UpdateIntroBar);  IntroNextSection=345;   end;345begin  ParamListen=Toy.Listen(′justright/7′,12,′SR′,′W′);  ifParamListen=7thenIntroNextSection=355  elseIntroNextSection=350;  Synchronize(UpdateIntroBar);end;350begin  ParamTalk=Toy.Talk(IntroPath+′in58.wav′,′S′);  Synchronize(UpdateIntroBar);  IntroNextSection=351;  end;351begin  ParamListen=Toy.Listen(′justright/7′,12,′SR′,′W′);  ifParamListen=7thenIntroNextSection=355  elseIntroNextSection=360;  Synchronize(UpdateIntroBar);  end;355begin  ParamTalk=Toy.Talk(IntroPath+′in58m.wav′,′EL′);  Synchronize(UpdateIntroBar);  IntroNextSection=356;  end;356begin  ParamTalk=Toy.Talk(IntroPath+′in57.wav′,′S′);  Synchronize(UpdateIntroBar);  IntroNextSection=360;  end;360begin  ParamTalk=Toy.Talk(IntroPath+′in59.wav′,′S′);  Synchronize(UpdateIntroBar);  IntroNextSection=365;  end;365begin  ParamListen=Toy.Listen(′bears/7′,12,′SR′,′W′);  ifParamListen=7thenIntroNextSection=370  elseIntroNextSection=371;  Synchronize(UpdateIntroBar);  end;370begin  ParamTalk=Toy.Talk(IntroPath+′in60.wav′,′S′);  Synchronize(UpdateIntroBar);IntroNextSection=375;  end;371begin  ParamTalk=Toy.Talk(IntroPath+′in60a.wav′,′S′);  Synchronize(UpdateIntroBar);  IntroNextSection=375;  end;375begin  ParamTalk=Toy.Talk(IntroPath+′in61m.wav′,′SP11′);  Synchronize(UpdateIntroBar);  IntroNextSection=385;  end;380begin  {ParamTalk=Toy.Talk(IntroPath+′in61.wav′,′S′);  Synchronize(UpdateIntroBar);  IntroNextSection=385;}  end;385begin  ParamListen=Toy.Listen(′toohot/1,toocold/2,justright/3′,  12,′SR′,′W′);  caseParamListenof  1IntroNextSection=390;  2IntroNextSection=400;  3IntroNextSection=405;  elseIntroNextSection=410;  end;  Synchronize(UpdateIntroBar);  end;390begin  ParamTalk=Toy.Talk(IntroPath+′in62.wav′,′S′);  Synchronize(UpdateIntroBar);  IntroNextSection=415;  end;400begin  ParamTalk=Toy.Talk(IntroPath+′in63.wav′,′S′);  Synchronize(UpdateIntroBar);  IntroNextSection=415;end;405begin  ParamTalk=Toy.Talk(IntroPath+′in64.wav′,′S′);  Synchronize(UpdateIntroBar);  IntroNextSection=415;  end;  410begin  ParamTalk=Toy.Talk(IntroPath+′in62.wav+′+IntroPath+′in63.wav+′  +IntroPath+′in64.wav+′,′S′);  Synchronize(UpdateIntroBar);  IntroNextSection=411;  end;  411begin  ParamTalk=Toy.Talk(IntroPath+′in67m.wav′,′S′);  Synchronize(UpdateIntroBar);  IntroNextSection=415;  end;  415begin  ParamTalk=Toy.Talk(IntroPath+′in68.wav′,′S′);  Synchronize(UpdateIntroBar);  IntroNextSection=416;  end;  416begin  ParamListen=Toy.Wait(12,′W′);  ifParamListen=3thenIntroNextSection=419  elseIntroNextSection=417;  Synchronize(UpdateIntroBar);  end;  417begin  ParamTalk=Toy.Talk(IntroPath+′in68a.wav′,′S′);  ifParamTalk=3thenIntroNextSection=419  elseIntroNextSection=418;  Synchronize(UpdateIntroBar);  end;  418beginParamListen=Toy.Wait(12,′W′);  ifParamListen=3thenIntroNextSection=419  elseIntroNextSection=420;  Synchronize(UpdateIntroBar);  end;  419begin  ParamTalk=Toy.Talk(IntroPath+′in???.wav′,′S′);  Synchronize(UpdateIntroBar);  IntroNextSection=420;  end;  420begin  ParamTalk=Toy.Talk(IntroPath+′in68m.wav′,′E′);  Synchronize(UpdateIntroBar);  IntroNextSection=425;  end;  425begin  ParamTalk=Toy.Talk(IntroPath+′in69.wav′,′S′);  Synchronize(UpdateIntroBar);  IntroNextSection=430;  end;  430begin  if(Time<StrToTime(′200000′))and(Time>StrToTime(′50000′))  thenIntroNextSection=435  elseIntroNextSection=440;  Synchronize(UpdateIntroBar);  end;  435begin  ParamTalk=Toy.Talk(IntroPath+′in70.wav′,′S′);  Synchronize(UpdateIntroBar);  IntroNextSection=436;  end;  436begin  ParamTalk=Toy.Talk(IntroPath+′in70m.wav′,′S′);  Synchronize(UpdateIntroBar);  IntroNextSection=-1;//GotoStoryAnyTimeStory  PlayNextSection=1;end;  440begin  ParamTalk=Toy.Talk(IntroPath+′in71.wav′,′S′);  Synchronize(UpdateIntroBar);  IntroNextSection=441;  end;  441begin  ParamTalk=Toy.Talk(IntroPath+′in71m.wav′,′S′);  Synchronize(UpdateIntroBar);  IntroNextSection=-1;  PlayNextSection=-1;//GotoMenuBedTimeStory  end;  end;//-----------endofIntrosesions-----------------------------------//=========PLAY================//---------------writehereallPlaysessions----------------------//=================================  casePlayNextSectionof  1begin  {sleep(300);  ParamTalk=Toy.Talk(PlayPath+′in001.wav′,′E′);  ParamListen=Toy.Listen(′yes/1,no,2′,1.5,′SRandSensor′);  PlayNextSection=2;  end;  2begin  ParamTalk=Toy.Talk(PlayPath+′in01a.wav′,′E′);  Synchronize(UpdatePlayBar);  PlayNextSection=3;  end;  3begin  ParamTalk=Toy.Talk(PlayPath+′in01b.wav′,′EL′);  Synchronize(UpdatePlayBar);  PlayNextSection=5;  end;4begin  {sleep(300);  PlayNextSection=5;}  end;  5begin  ParamTalk=Toy.Talk(PlayPath+′in01.wav′,′S′);  Synchronize(UpdatePlayBar);  PlayNextSection=-1;  end;{else  begin  Terminate;  bit;  end;}  end;//-----------------endofPlaysesions-----------------------*}//======ThePrincessandthePe==========//--------------writehereallsessions---------------------//=============================  casePrincessNextSectionof  1begin  GamePrincessStatus=′Princess′;//Defaultis"Princess"  PrincessNextSection=5;  end;  5begin  ParamTalk=Toy.Talk(PeasPath+′pp005.wav′,′S′);  Synchronize(UpdatePrincessBar);  PrincessNextSection=10;  end;  10begin  ParamListen=Toy.Listen(′boy/1,girl/2′,DTime,′SR′,′W′);  caseParamListenof1PrincessNextSection=30;  2PrincessNextSection=35;  elsePrincessNextSection=15;  end;  Synchronize(UpdatePrincessBar);  end;15begin  ParamTalk=Toy.Talk(PeasPath+′pp020.wav′,′S′);  Synchronize(UpdatePrincessBar);  PrincessNextSection=20;  end;20begin  ParamListen=Toy.Listen(′boy/1,girl/2′,DTime,′SR′,′W′);  caseParamListenof  1PrincessNextSection=30;  2PrincessNextSection=35;  elsePrincessNextSection=25;  end;  Synchronize(UpdatePrincessBar);  end;25begin  ParamTalk=Toy.Talk(PeasPath+′pp025.wav′,′S′);  Synchronize(UpdatePrincessBar);  PrincessNextSection=40;  end;30begin  GamePrincessStatus=′Prince′;//Storyisfora"Prince"  ParamTalk=Toy.Talk(PeasPath+′pp030.wav′,′S′);  Synchronize(UpdatePrincessBar);  PrincessNextSection=31;  end;31begin  ParamTalk=Toy.Talk(PeasPath+′pp031.wav′,′S′);  Synchronize(UpdatePrincessBar);  PrincessNextSection=37;  end;35begin  ParamTalk=Toy.Talk(PeasPath+′pp035.wav′,′S′);  Synchronize(UpdatePrincessBar);  PrincessNextSection=36;  end;  36begin  ParamTalk=Toy.Talk(PeasPath+′pp036.wav′,′S′);  Synchronize(UpdatePrincessBar);  PrincessNextSection=37;  end;  37begin  ifGamePrincessStatus=′Prince′thenPrincessNextSection=40  elsePrincessNextSection=100;  Synchronize(UpdatePrincessBar);  end;  40begin  ParamTalk=Toy.Talk(PeasPath+′pp040m.wav′,′S′);  Synchronize(UpdatePrincessBar);  PrincessNextSection=45;  end;  45begin  ParamTalk=Toy.Talk(PeasPath+′pp045.wav′,′S′);  PrincessNextSection=50;  ifFavoriteColor=′Red′thenPrincessNextSection=50;  ifFavoriteColor=′Blue′thenPrincessNextSection=55;  ifFavoriteColor=′Yellow′thenPrincessNextSection=60;  Synchronize(UpdatePrincessBar);  end;  50begin  ParamTalk=Toy.Talk(PeasPath+′pp050.wav′,′S′);  PrincessNextSection=65;  ifFavoriteFood=′Pizza′thenPrincessNextSection=65;  ifFavoriteFood=′FrenchFries′thenPrincessNextSection=70;  ifFavoriteFood=′MacaroniAndCheese′thenPrincessNextSection=75;Synchronize(UpdatePrincessBar);  end;  55begin  ParamTalk=Toy.Talk(PeasPath+′pp055.wav′,′S′);  PrincessNextSection=65;  ifFavoriteFood=′Pizza′thenPrincessNextSection=65;  ifFavoriteFood=′FrenchFries′thenPrincessNextSection=70;  ifFavoriteFood=′MacaroniAndCheese′thenPrincessNextSection=75;  Synchronize(UpdatePrincessBar);  end;  60begin  ParamTalk=Toy.Talk(PeasPath+′pp060.wav′,′S′);  PrincessNextSection=65;  ifFavoriteFood=′Pizza′thenPrincessNextSection=65;  ifFavoriteFood=′FrenchFries′thenPrincessNextSection=70;  ifFavotiteFood=′MacaroniAndCheese′thenPrincessNextSection=75;  Synchronize(UpdatePrincessBar);  end;  65begin  ParamTalk=Toy.Talk(PeasPath+′pp065.wav′,′S′);  PrincessNextSection=80;  ifFavoriteActivity=′Drawing′thenPrincessNextSection=80;ifFavoriteActivity=′PlayingComputerGames′thenPrincessNextSection=85;  ifFavoriteActivity=′MakeBelieve′thenPrincessNextSection=90;  Synchronize(UpdatePrincessBar);  end;  70begin  ParamTalk=Toy.Talk(PeasPath+′pp070.wav′,′S′);  PrincessNextSection=80;  ifFavoriteActivity=′Drawing′thenPrincessNextSection=80;ifFavoriteActivity=′PlayingComputerGames′thenPrincessNextSection=85;  ifFavoriteActivity=′MakeBelieve′thenPrincessNextSection=90;  Synchronize(UpdatePrincessBar);  end;  75begin  ParamTalk=Toy.Talk(PeasPath+′pp075.wav′,′S′);  PrincessNextSection=80;  ifFavoriteActivity=′Drawing′thenPrincessNextSection=80;  ifFavoriteActivity=′PlayingComputerGames′thenPrincessNextSection=85;  ifFavoriteActivity=′MakeBelieve′thenPrincessNextSection=90;  Synchronize(UpdatePrincessBar);  end;  80begin  ParamTalk=Toy.Talk(PeasPath+′pp080.wav′,′S′);  Synchronize(UpdatePrincessBar);  PrincessNextSection=95;  end;  85begin  ParamTalk=Toy.Talk(PeasPath+′pp085.wav′,′S′);  Synchronize(UpdatePrincessBar);  PrincessNextSection=95;  end;  90begin  ParamTalk=Toy.Talk(PeasPath+′pp090.wav′,′S′);  Synchronize(UpdatePrincessBar);  PrincessNextSection=95;  end;  95begin  ParamTalk=Toy.Talk(PeasPath+′pp095.wav′,′S′);  Synchronize(UpdatePrincessBar);  PrincessNextSection=165;  end;100begin  ParamTalk=Toy.Talk(PeasPath+′pp100.wav′,′S′);  Synchrcnize(UpdatePrincessBar);  PrincessNextSection=105;  end;  105begin  ParamTalk=Toy.Talk(PeasPath+′pp105.wav′,′S′);  Synchronize(UpdatePrincessBar);  PrincessNextSection=110;  end;  110begin  ParamTalk=Toy.Talk(PeasPath+′pp110.wav′,′S′);  PrincessNextSection=115;  ifFavoriteColor=′Red′thenPrincessNextSection=115;  ifFavoriteColor=′Blue′thenPrincessNextSection=120;  ifFavoriteColor=′Yellow′thenPrincessNextSection=125;  Synchronize(UpdatePrincessBar);  end;  115begin  ParamTalk=Toy.Talk(PeasPath+′pp115.wav′,′S′);  PrincessNextSection=130;  ifFavoriteFood=′Pizza′thenPrincessNextSection=130;  ifFavoriteFood=′FrenchFries′thenPrincessNextSection=135;  ifFavoriteFood=′MacaroniAndCheese′thenPrincessNextSection=140;  Synchronize(UpdatePrincessBar);  end;  120begin  ParamTalk=Toy.Talk(PeasPath+′pp120.wav′,′S′);  PrincessNextSection=130;  ifFavoriteFood=′Pizza′thenPrincessNextSection=130;  ifFavoriteFood=′FrenchFries′thenPrincessNextSection=135;  ifFavoriteFood=′MacaroniAndCheese′thenPrincessNextSection=140;Synchronize(UpdatePrincessBar);  end;  125begin  ParamTalk=Toy.Talk(PeasPath+′pp125.wav′,′S′);  PrincessNextSection=130;  ifFavoriteFood=′Pizza′thenPrincessNextSection=130;  ifFavoriteFood=′FrenchFries′thenPrincessNextSection=135;  ifFavoriteFood=′MacaroniAndCheese′thenPrincessNextSection=140;  Synchronize(UpdatePrincessBar);  end;  130begin  ParamTalk=Toy.Talk(PeasPath+′pp130.wav′,′S′);  PrincessNextSection=145;  ifFavoriteActivity=′Drawing′thenPrincessNextSection=145;  ifFavoriteActivity=′PlayingComputerGames′thenPrincessNextSection=150;  ifFavoriteActivity=′MakeBelieve′thenPrincessNextSection=155;  Synchronize(UpdatePrincessBar);  end;  135begin  ParamTalk=Toy.Talk(PeasPath+′pp135.wav′,′S′);  PrincessNextSection=145;  ifFavoriteActivity=′Drawing′thenPrincessNextSection=145;  ifFavoriteActivity=′PlayingComputerGames′thenPrincessNextSection=150;  ifFavoriteActivity=′MakeBelieve′thenPrincessNextSection=155;  Synchronize(UpdatePrincessBar);  end;  140begin  ParamTalk=Toy.Talk(PeasPath+′pp140.wav′,′S′);  PrincessNextSection=145;ifFavoriteActivity=′Drawing′thenPrincessNextSection=145;  ifFavoriteActivity=′PlayingComputerGames′thenPrincessNextSection=150;  ifFavoriteActivity=′MakeBelieve′thenPrincessNextSection=155;  Synchronize(UpdatePrincessBar);  end;145begin  ParamTalk=Toy.Talk(PeasPath+′pp145.wav′,′S′);  Synchronize(UpdatePrincessBar);  PrincessMextSection=160;  end;150begin  ParamTalk=Toy.Talk(PeasPath+′pp150.wav′,′S′);  Synchronize(UpdatePrincessBar);  PrincessNextSection=160;  end;155begin  ParamTalk=Toy.Talk(PeasPath+′pp155.wav′,′S′);  Synchronize(UpdatePrincessBar);  PrincessNextSection=160;  end;160begin  ParamTalk=Toy.Talk(PeasPath+′pp160.wav′,′S′);  Synchronize(UpdatePrincessBar);  PrincessNextSection=170;  end;165begin  ParamTalk=Toy.Talk(PeasPath+′pp165.wav′,′S′);  Synchronize(UpdatePrincessBar);  PrincessNextSection=171;  end;170begin  ParamTalk=Toy.Talk(PeasPath+′pp170.wav′,′S′);  Synchronize(UpdatePrinceasBar);PrincessNextSection=172;  end;172begin  ParamTalk=Toy.Talk(PeasPath+′pp172m.wav′,′S′);  Synchronize(UpdatePrincessBar);  PrincessNextSection=175;  end;175begin  ParamTalk=Toy.Talk(PeasPath+′pp175.wav′,′S′);  Synchronize(UpdatePrincessBar);  PrincessNextSection=180;  end;180begin  ParamTalk=Toy.Talk(PeasPath+′pp180.wav′,′S′);  Synchronize(UpdatePrincessBar);  PrincessNextSection=181;  end;181begin  ParamTalk=Toy.Talk(PeasPath+′pp181m.wav′,′EL′);  Synchronize(UpdatePrincessBar);  PrincessNextSection=185;  end;185begin  ParamTalk=Toy.Talk(PeasPath+′pp185.wav′,′S′);  Synchronize(UpdatePrincessBar);  PrincessNextSection=190;  end;190begin  ParamTalk=Toy.Talk(PeasPath+′pp190.wav′,′S′);  Synchronize(UpdatePrincessBar);  PrincessNextSection=195;  end;195begin  ParamListen=Toy.Listen(′yes/1,no/2′,DTime,′SR′,′W′);caseParamListenof  1IntroNextSection=245;  2IntroNextSection=215;  elseIntroNextSection=200;  end;  Synchronize(UpdateIntroBar);  end;200begin  ParamTalk=Toy.Talk(PeasPath+′pp200.wav′,′S′);  Synchronize(UpdatePrincessBar);  PrincessNextSection=205;  end;205begin  ParamListen=Toy.Listen(′yes/1,no/2′,DTime,′SR′,′W′);  caseParamListenof  1IntroNextSection=245;  2IntroNextSection=215;  elseIntroNextSection=210;  end;  Synchronize(UpdateIntroBar);  end;210begin  ParamTalk=Toy.Talk(PeasPath+′pp210.wav′,′S′);  Synchronize(UpdatePrincessBar);  PrincessNextSection=245;  end;215begin  ParamTalk=Toy.Talk(PeasPath+′pp215.wav′,′S′);  Synchronize(UpdatePrincessBar);  PrincessNextSection=220;  end;220begin  ParamTalk=Toy.Talk(PeasPath+′pp220m.wav′,′S′);  ifGamePrincessStatus=′Prince′thenPrincessNextSection=226  elsePrincessNextSection=225;  Synchronize(UpdatePrincessBar);  end;225begin  ParamTalk=Toy.Talk(PeasPath+′pp225.wav′,′S′);//change  Synchronize(UpdatePrincessBar);  PrincessNextSection=230;  end;226begin  ParamTalk=Toy.Talk(PeasPath+′pp226.wav′,′S′);//change  Synchronize(UpdatePrincessBar);  PrincessNextSection=235;  end;230begin  ParamTalk=Toy.Talk(PeasPath+′pp230.wav′,′S′);  Synchronize(UpdatePrincessBar);  PrincessNextSection=240;  end;235begin  ParamTalk=Toy.Talk(PeasPath+′pp235.wav′,′S′);  Synchronize(UpdatePrincessBar);  PrincessNextSection=240;  end;240begin  ParamTalk=Toy.Talk(PeasPath+′pp240.wav′,′S′);  ifGamePrincessStatus=′Prince′thenPrincessNextSection=255  elsePrincessNextSection=250;  Synchronize(UpdatePrincessBar);  end;245begin  ParamTalk=Toy.Talk(PeasPath+′pp245.wav′,′S′);  ifGamePrincessStatus=′Prince′thenPrincessNextSection=255  elsePrincessNextSection=250;  Synchronize(UpdatePrincessBar);  end;249begin  ParamTalk=Toy.Talk(PeasPath+′pp249m.wav′,′S′);  PrincessNextSection=249;Synchronize(UpdatePrincessBar);  end;250begin  ParamTalk=Toy.Talk(PeasPath+′pp250.wav′,′S′);  Synchronize(UpdatePrincessBar);  PrincessNextSection=260;  end;255begin  ParamTalk=Toy.Talk(PeasPath+′pp255.wav′,′S′);  Synchronize(UpdatePrincessBar);  PrincessNextSection=265;  end;260begin  ParamTalk=Toy.Talk(PeasPath+′pp260.wav′,′S′);  Synchronize(UpdatePrincessBar);  PrincessNextSection=270;  end;265begin  ParamTalk=Toy.Talk(PeasPath+′pp265.wav′,′S′);  Synchronize(UpdatePrincessBar);  PrincessNextSection=270;  end;270begin  ParamTalk=Toy.Talk(PeasPath+′pp270.wav′,′S′);//change  ifGamePrincessStatus=′Prince′thenPrincessNextSection=280  elsePrincessNextSection=275;  Synchronize(UpdatePrincessBar);  end;275begin  ParamTalk=Toy.Talk(PeasPath+′pp275.wav′,′S′);//change  Synchronize(UpdatePrincessBar);  PrincessNextSection=285;  end;280beginParamTalk=Toy.Talk(PeasPath+′pp280.wav′,′S′);  Synchronice(UpdatePrincessBar);  PrincessNextSection=290;  end;  285begin  ParamTalk=Toy.Talk(PeasPath+′pp285.wav′,′S′);  Synchronize(UpdatePrincessBar);  PrincessNextSection=295;  end;  290begin  ParamTalk=Toy.Talk(PeasPath+′pp290.wav′,′S′);  Synchronize(UpdatePrincessBar);  PrincessNextSection=295;  end;  295begin  ParamListen=Toy.Listen(′yes/1,no/2′,DTime,′SR′,′W′);  caseParamListenof  1begin  ifGamePrincessStatus=′Prince′thenPrincessNextSection=320  elsePrincessNextSection=315;  end;  2IntroNextSection=345;  elseIntroNextSection=300;  end;  Synchronize(UpdateIntroBar);  end;  300begin  ParamTalk=Toy.Talk(PeasPath+′pp300.wav′,′S′);  Synchronize(UpdatePrincessBar);  PrincessNextSection=305;  end;  305begin  ParamListen=Toy.Listen(′yes/1,no/2′,DTime,′SR′,′W′);  caseParamListenof  1beginifGamePrincessStatus=′Prince′thenPrincessNextSection=320  elsePrincessNextSection=315;  end;  2IntroNextSection=345;  elseIntroNextSection=310;  end;  Synchronize(UpdateIntroBar);  end;  310begin  ParamTalk=Toy.Talk(PeasPath+′pp310.wav′,′S′);  Synchronize(UpdatePrincessBar);  PrincessNextSection=345;  end;  315begin  ParamTalk=Toy.Talk(PeasPath+′pp315.wav′,′S′);  Synchronize(UpdatePrincessBar);  PrincessNextSection=325;  end;  320begin  ParamTalk=Toy.Talk(PeasPath+′pp320.wav′,′S′);  Synchronize(UpdatePrincessBar);  PrincessNextSection=326;  end;  325begin  ParamListen=Toy.Listen(′queen/1,king/2,prince/3′,DTime,′SR′,′W′);  caseParamListenof  1IntroNextSection=445;  2IntroNextSection=450;  3IntroNextSection=465;  elseIntroNextSection=450;  end;  Synchronize(UpdateIntroBar);  end;  326beginParamListen=Toy.Listen(′queen/1,king/2,princess/3′,DTime,′SR′,′W′);  caseParamListenof  1IntroNextSection=440;  2IntroNextSection=450;  3IntroNextSection=460;  elseIntroNextSection=450;  end;  Synchronize(UpdateIntroBar);  end;  330begin  ParamTalk=Toy.Talk(PeasPath+′pp330.wav′,′S′);  Synchronize(UpdatePrincessBar);  PrincessNextSection=335;  end;  331begin  ParamTalk=Toy.Talk(PeasPath+′pp330.wav′,′S′);  Synchronize(UpdatePrincessBar);  PrincessNextSection=336;  end;  335begin  ParamListen=Toy.Listen(′queen/1,king/2,prince/3′,DTime,′SR′,′W′);  caseParamListenof  1IntroNextSection=445;  2IntroNextSection=450;  3IntroNextSection=465;  elseIntroNextSection=340;  end;  Synchronize(UpdateIntroBar);  end;  336begin  ParamListen=Toy.Listen(′queen/1,king/2,princess/3′,DTime,′SR′,′W′);  caseParamListenof  1IntroNextSection=440;  2IntroNextSection=450;  3IntroNextSection=460;elseIntroNextSection=340;  end;  Synchronize(UpdateIntroBar);  end;340begin  ParamTalk=Toy.Talk(PeasPath+′pp340.wav′,′S′);  Synchronize(UpdatePrincessBar);  PrincessNextSection=450;  end;345begin  ParamTalk=Toy.Talk(PeasPath+′pp345.wav′,′S′);  ifGamePrincessStatus=′Prince′thenPrincessNextSection=350  elsePrincessNextSection=400;  Synchronize(UpdatePrincessBar);  end;350begin  ParamTalk=Toy.Talk(PeasPath+′pp350.wav′,′S′);  Synchronize(UpdatePrincessBar);  PrincessNextSection=405;  end;400begin  ParamTalk=Toy.Talk(PeasPath+′pp400.wav′,′S′);  Synchronize(UpdatePrincessBar);  PrincessNextSection=405;  end;405begin  ParamTalk=Toy.Talk(PeasPath+′pp405.wav′,′S′);  ifGamePrincessStatus=′Prince′thenPrincessNextSection=410  elsePrincessNextSection=420;  Synchronize(UpdatePrincessBar);  end;410begin  ParamTalk=Toy.Talk(PeasPath+′pp410.wav′,′S′);  Synchronize(UpdatePrincessBar);  PrincessNextSection=430;  end420begin  ParamTalk=Toy.Talk(PeasPath+′pp420.wav′,′S′);  Synchronize(UpdatePrincessBar);  PrincessNextSection=430;  end;425begin  ParamTalk=Toy.Talk(PeasPath+′pp425.wav′,′S′);  ifGamePrincessStatus=′Prince′thenPrincessNextSection=430  elsePrincessNextSection=435;  Synchronize(UpdatePrincessBar);  end;430begin  ParamTalk=Toy.Talk(PeasPath+′pp430.wav′,′S′);  Synchronize(UpdatePrincessBar);  PrincessNextSection=470;  end;435begin  ParamTalk=Toy.Talk(PeasPath+′pp435.wav′,′S′);  Synchronize(UpdatePrincessBar);  PrincessNextSection=470;  end;440begin  ParamTalk=Toy.Talk(PeasPath+′pp440.wav′,′S′);  Synchronize(UpdatePrincessBar);  PrincessNextSection=470;  end;445begin  ParamTalk=Toy.Talk(PeasPath+′pp445.wav′,′S′);  Synchronize(UpdatePrincessBar);  PrincessNextSection=470;  end;450begin  ParamTalk=Toy.Talk(PeasPath+′pp450.wav′,′S′);  Synchronize(UpdatePrincessBar);PrincessNextSection=470;  end;460begin  ParamTalk=Toy.Talk(PeasPath+′pp460.wav′,′S′);  Synchronize(UpdatePrincessBar);  PrincessNextSection=470;  end;465begin  ParamTalk=Toy.Talk(PeasPath+′pp465.wav′,′S′);  Synchronize(UpdatePrincessBar);  PrincessNextSection=470;  end;469begin  ParamTalk=Toy.Talk(PeasPath+′pp436m.wav′,′S′);  Synchronize(UpdatePrincessBar);  PrincessNextSection=470;  end;470begin  ParamTalk=Toy.Talk(PeasPath+′pp470.wav′,′S′);  Synchronize(UpdatePrincessBar);  PrincessNextSection=472;  end;472begin  ParamTalk=Toy.Talk(PeasPath+′pp472.wav′,′S′);  Synchronize(UpdatePrincessBar);  PrincessNextSection=475;  end;475begin  ParamTalk=Toy.Talk(PeasPath+′pp475.wav′,′S′);  Synchronize(UpdatePrincessBar);  PrincessNextSection=480;  end;480begin  ParamTalk=Toy.Talk(PeasPath+′pp480.wav′,′S′);  Synchronize(UpdatePrincessBar);PrincessNextSection=485;  end;485begin  ParamTalk=Toy.Talk(PeasPath+′pp485.wav′,′S′);  Synchronize(UpdatePrincessBar);  PrincessNextSection=490;  end;490begin  ParamTalk=Toy.Talk(PeasPath+′pp490m.wav′,′S′);  Synchronize(UpdatePrincessBar);  PrincessNextSection=495;  end;495begin  ParamTalk=Toy.Talk(PeasPath+′pp495.wav′,′S′);  ifGamePrincessStatus=′Prince′thenPrincessNextSection=505  elsePrincessNextSection=500;  Synchronize(UpdatePrincessBar);  end;500begin  ParamTalk=Toy.Talk(PeasPath+′pp500.wav′,′S′);  Synchronize(UpdatePrincessBar);  PrincessNextSection=510;  end;505begin  ParamTalk=Toy.Talk(PeasPath+′pp505.wav′,′S′);  Synchronize(UpdatePrincessBar);  PrincessNextSection=510;  end;510begin  ParamTalk=Toy.Talk(PeasPath+′pp510m.wav′,′S′);  Synchronize(UpdatePrincessBar);  PrincessNextSection=515;  end;515beginParamTalk=Toy.Talk(PeasPath+′pp515.wav′,′S′);  ifGamePrincessStatus=′Prince′thenPrincessNextSection=516  elsePrincessNextSection=517;  Synchronize(UpdatePrincessBar);  end;516begin  ParamTalk=Toy.Talk(PeasPath+′pp516m.wav′,′EC′);  Synchronize(UpdatePrincessBar);  PrincessNextSection=520;  end;517begin  ParamTalk=Toy.Talk(PeasPath+′pp517m.wav′,′EC′);  Synchronize(UpdatePrincessBar);  PrincessNextSection=520;  end;518begin  ParamTalk=Toy.Talk(PeasPath+′pp521m.wav′,′EL′);  Synchronize(UpdatePrincessBar);  PrincessNextSection=520;  end;520begin  ParamTalk=Toy.Talk(PeasPath+′pp520.wav′,′S′);  Synchronize(UpdatePrincessBar);  PrincessNextSection=525;  end;525begin  ParamTalk=Toy.Talk(PeasPath+′pp525.wav′,′S′);//change  ifGamePrincessStatus=′Prince′thenPrincessNextSection=535  elsePrincessNextSection=530;  Synchronize(UpdatePrincessBar);  end;530begin  ParamTalk=Toy.Talk(PeasPath+′pp530.wav′,′S′);  Synchronize(UpdatePrincessBar);  PrincessNextSection=540;  end;535begin  ParamTalk=Toy.Talk(PeasPath+′pp535.wav′,′S′);  Synchronize(UpdatePrincessBar);  PrincessNextSection=545;  end;540begin  ParamTalk=Toy.Talk(PeasPath+′pp540.wav′,′S′);  Synchronize(UpdatePrincessBar);  PrincessNextSection=550;  end;545begin  ParamTalk=Toy.Talk(PeasPath+′pp545.wav′,′S′);  Synchronize(UpdatePrincessBar);  PrincessNextSection=550;  end;550begin  ParamTalk=Toy.Talk(PeasPath+′pp550.wav′,′S′);  PrincessNextSection=555;  ifFavoriteColor=′Red′thenPrincessNextSection=555;  ifFavoriteColor=′Blue′thenPrincessNextSection=565;  ifFavoriteColor=′Yellow′thenPrincessNextSection=560;  Synchronize(UpdatePrincessBar);  end;555begin  ParamTalk=Toy.Talk(PeasPath+′pp555.wav′,′S′);  PrincessNextSection=575;  ifFavoriteFood=′Pizza′thenPrincessNextSection=575;  ifFavoriteFood=′FrenchFries′thenPrincessNextSection=580;  ifFavoriteFood=′MacaroniAndCheese′thenPrincessNextSection=585;  Synchronize(UpdatePrincessBar);  end;560begin  ParamTalk=Toy.Talk(PeasPath+′pp560.wav′,′S′);  PrincessNextSection=575;ifFavoriteFood=′Pizza′thenPrincessNextSection=575;  ifFavoriteFood=′FrenchFries′thenPrincessNextSection=580;  ifFavoriteFood=′MacaroniAndCheese′thenPrincessNextSection=585;  Synchronize(UpdatePrincessBar);  end;  565begin  ParamTalk=Toy.Talk(PeasPath+′pp565.wav′,′S′);  PrincessNextSection=575;  ifFavoriteFood=′Pizza′thenPrincessNextSection=575;  ifFavoriteFood=′FrenchFries′thenPrincessNextSection=580;  ifFavoriteFood=′MacaroniAndCheese′thenPrincessNextSection=585;  Synchronize(UpdatePrincessBar);  end;  575begin  ParamTalk=Toy.Talk(PeasPath+′pp575.wav′,′S′);  PrincessNextSection=595;  ifFavoriteAnimal=′Horse′thenPrincessNextSection=595;  ifFavoriteAnimal=′Dog′thenPrincessNextSection=600;  ifFavoriteAnimal=′Cat′thenPrincessNextSection=605;  Synchronize(UpdatePrincessBar);  end;  580begin  ParamTalk=Toy.Talk(PeasPath+′pp580.wav′,′S′);  PrincessNextSection=595;  ifFavoriteAnimal=′Horse′thenPrincessNextSection=595;  ifFavoriteAnimal=′Dog′thenPrincessNextSection=600;  ifFavoriteAnimal=′Cat′thenPrincessNextSection=605;  Synchronize(UPdatePrincessBar);  end;  585begin  ParamTalk=Toy.Talk(PeasPath+′pp585.wav′,′S′);  PrincessNextSection=595;  ifFavoriteAnimal=′Horse′thenPrincessNextSection=595;  ifFavoriteAnimal=′Dog′thenPrincessNextSection=600;ifFavoriteAnimal=′Cat′thenPrincessNextSection=605;  Synchronize(UpdatePrincessBar);  end;595begin  ParamTalk=Toy.Talk(PeasPath+′pp595.wav′,′S′);  PrincessNextSection=610;  ifFavoriteActivity=′Draw′thenPrincessNextSection=610;  ifFavoriteActivity=′PlayComputerGame′thenPrincessNextSection=615;  ifFavoriteActivity=′MakeBelieve′thenPrincessNextSection=620;  Synchronize(UpdatePrincessBar);  end;600begin  ParamTalk=Toy.Talk(PeasPath+′pp600.wav′,′S′);  PrincessNextSection=610;  ifFavoriteActivity=′Draw′thenPrincessNextSection=610;  ifFavoriteActivity=′PlayComputerGame′thenPrincessNextSection=615;  ifFavoriteActivity=′MakeBelieve′thenPrincessNextSection=620;  Synchronize(UpdatePrincessBar);  end;605begin  ParamTalk=Toy.Talk(PeasPath+′pp605.wav′,′S′);  PrincessNextSection=610;  ifFavoriteActivity=′Draw′thenPrincessNextSection=610;  ifFavoriteActivity=′PlayComputerGame′thenPrincessNextSection=615;  ifFavoriteActivity=′MakeBelieve′thenPrincessNextSection=620;  Synchronize(UpdatePrincessBar);  end;610begin  ParamTalk=Toy.Talk(PeasPath+′pp610.wav′,′S′);  Synchronize(UpdatePrincessBar);  PrincessNextSection=630;end;615begin  ParamTalk=Toy.Talk(PeasPath+′pp615.wav′,′S′);  Synchronize(UpdatePrincessBar);  PrincessNextSection=630;  end;620begin  ParamTalk=Toy.Talk(PeasPath+′pp620.wav′,′S′);  Synchronize(UpdatePrincessBar);  PrincessNextSection=630;  end;630begin  ParamTalk=Toy.Talk(PeasPath+′pp630m.wav′,′S′);  Synchronize(UpdatePrincessBar);  PrincessNextSection=635;  end;635begin  ParamTalk=Toy.Talk(PeasPath+′pp635.wav′,′S′);  Synchronize(UpdatePrincessBar);  PrincessNextSection=-1;  PresentationNextSection=4010;  if(ChildSex=′Girl′)and(Time>StrToTime(′190000′))then  begin  PrincessNextSection=640;  PresentationNextSection=-1;  end;  if(ChildSex=′Boy′)and(Time>StrToTime(′190000′))then  begin  PrincessNextSection=645;  PresentationNextSection=-1;  end;  end;640begin  ParamTalk=Toy.Talk(PeasPath+′pp640.wav′,′S′);  Synchronize(UpdatePrincessBar);  PrincessNextSection=650;  end;645begin  ParamTalk=Toy.Talk(PeasPath+′pp640.wav′,′S′);  Synchronize(UpdatePrincessBar);  PrincessNextSection=650;  end;  650begin  ParamTalk=Toy.Talk(PeasPath+′pp650m.wav′,′S′);  Synchronize(UpdatePrincessBar);  PrincessNextSection=-1;  PresentationNextSection=4010;  end;  {else  begin  Terminate;  Exit;  end;}  end;//-------endof"ThePrincessandthePea"sesions--------{*//=========TheStoryMenu============//------------------writehereallsessions---------------//=============================  caseTheStoryMenuNextSectionof  1begin  {sleep(300);  ParamTalk=Toy.Talk(StoryMenuPath+′in001.wav′,′E′);  Paramisten=Toy.Listen(′yes/1,no,2′,1.5,′SRandSensor′);}  TheStoryMenuNextSection=5;  end;  5begin  ParamTalk=Toy.Talk(StoryMenuPath+′pp005.wav′,′S′);  Synchronize(UpdateTheStoryMenuBar);  TheStoryMenuNextSection=10;  end;10begin  ParamTalk=Toy.Talk(StoryMenuPath+′pp005.wav′,′S′);  Synchronize(UpdateTheStoryMenuBar);  TheStoryMenuNextSection=5;  end;15begin  ParamTalk=Toy.Talk(StoryMenuPath+′pp005.wav′,′S′);  Synchronize(UpdateTheStoryMenuBar);  TheStoryMenuNextSection=-1;  end;20begin  ParamTalk=Toy.Talk(StoryMenuPath+′pp005.wav′,′S′);  Synchronize(UpdateTheStoryMenuBar);  TheStoryMenuNextSection=10;  end;25begin  ParamTalk=Toy.Talk(StoryMenuPath+′pp005.wav′,′S′);  Synchronize(UpdateTheStoryMenuBar);  TheStoryMenuNextSection=10;  end;30begin  ParamTalk=Toy.Talk(StoryMenuPath+′pp005.wav′,′S′);  Synchronize(UpdateTheStoryMenuBar);  TheStoryMenuNextSection=5;  end;31begin  ParamTalk=Toy.Talk(StoryMenuPath+′pp005.wav′,′S′);  Synchronize(UpdateTheStoryMenuBar);  TheStoryMenuNextSection=-1;  end;35begin  ParamTalk=Toy.Talk(StoryMenuPath+′pp005.wav′,′S′);  Synchronize(UpdateTheStoryMenuBar);  TheStoryMenuNextSection=10;end;36begin  ParamTalk=Toy.Talk(StoryMenuPath+′pp005.wav′,′S′);  Synchronize(UpdateTheStoryMenuBar);  TheStoryMenuNextSection=10;  end;37begin  ParamTalk=Toy.Talk(StoryMenuPath+′pp005.wav′,′S′);  Synchronize(UpdateTheStoryMenuBar);  TheStoryMenuNextSection=5;  end;40begin  ParamTalk=Toy.Talk(StoryMenuPath+′pp005.wav′,′S′);  Synchronize(UpdateTheStoryMenuBar);  TheStoryMenuNextSection=-1;  end;45begin  ParamTalk=Toy.Talk(StoryMenuPath+′pp005.wav′,′S′);  Synchronize(UpdateTheStoryMenuBar);  TheStoryMenuNextSection=10;  end;50begin  ParamTalk=Toy.Talk(StoryMenuPath+′pp005.wav′,′S′);  Synchronize(UpdateTheStoryMenuBar);  TheStoryMenuNextSection=10;  end;55begin  ParamTalk=Toy.Talk(StoryMenuPath+′pp005.wav′,′S′);  Synchronize(UpdateTheStoryMenuBar);  TheStoryMenuNextSection=5;  end;60begin  ParamTalk=Toy.Talk(StoryMenuPath+′pp005.wav′,′S′);  Synchronize(UpdateTheStoryMenuBar);TheStoryMenuNextSection;=-1;  end;65begin  ParamTalk=Toy.Talk(StoryMenuPath+′pp005.wav′,′S′);  Synchronize(UpdateTheStoryMenuBar);  TheStoryNenuNextSection=10;  end;70begin  ParamTalk=Toy.Talk(StoryMenuPath+′pp005.wav′,′S′);  Synchronize(UpdateTheStoryMenuBar);  TheStoryMenuNextSection=10;  end;75begin  ParamTalk=Toy.Talk(StoryMenuPath+′pp005.wav′,′S′);  Synchronize(UpdateTheStoryMenuBar);  TheStoryMenuNextSection=5;  end;80begin  ParamTalk=Toy.Talk(StoryMenuPath+′pp005.wav′,′S′);  Synchronize(UpdateTheStoryMenuBar);  TheStoryMenuNextSection=-1;  end;85begin  ParamTalk=Toy.Talk(StoryMenuPath+′pp005.wav′,′S′);  Synchronize(UpdateTheStoryMenuBar);  TheStoryMenuNextSection=10;  end;90begin  ParamTalk=Toy.Talk(StoryMenuPath+′pp005.wav′,′S′);  Synchronize(UpdateTheStoryMenur);  TheStoryMenuNextSection=10;  end;95begin  ParamTalk=Toy.Talk(StoryMenuPath+′pp005.wav′,′S′);  Synchronize(UpdateTheStoryMenuBar);  370TheStoryMenuNextSection=5;  end;100begin  ParamTalk=Toy.Talk(StoryMenuPath+′pp005.wav′,′S′);  Synchronize(UpdateTheStoryMenuBar);  TheStoryMenuNextSection=-1;  end;105begin  ParamTalk=Toy.Talk(StoryMenuPath+′pp005.wav′,′S′);  Synchronize(UpdateTheStoryMenuBar);  TheStoryMenuNextSection=10;  end;110begin  ParamTalk=Toy.Talk(StoryMenuPath+′pp005.wav′,′S′);  Synchronize(UpdateTheStoryMenuBar);  TheStoryMenuNextSection=10;  end;115begin  ParamTalk=Toy.Talk(StoryMenuPath+′pp005.wav′,′S′);  Synchronize(UpdateTheStoryMenuBar);  TheStoryMenuNextSection=5;  end;120begin  ParamTalk=Toy.Talk(StoryMenuPath+′pp005.wav′,′S′);  Synchronize(UpdateTheStoryMenuBar);  TheStoryMenuNextSection=-1;  end;125begin  ParamTalk=Toy.Talk(StoryMenuPath+′pp005.wav′,′S′);  Synchronize(UpdateTheStoryMenuBar);  TheStoryMenuNextSection=10;  end;  end;//-------------------endof"TheStoryMenu"sesions-------------//==========Run-StoryMenu==================//------------------writehereallsessions------------------------------------//======================================  caseRunStoryMenuNextSectionof  1begin  {sleep(300);  ParamTalk=Toy.Talk(RunStoryPath+′in001.wav′,′E′);  ParamListen=Toy.Listen(′yes/1,no,2′,1.5,′SRandSensor′);}  RunStoryMenuNextSection=5;  end;  5begin  ParamTalk=Toy.Talk(RunStoryPath+′pp005.wav′,′S′);  Synchronize(UpdateRunStoruyMenuBar);  RunStoryMenuNextSection=10;  end;  10begin  ParamTalk=Toy.Talk(RunStoryPath+′pp005.wav′,′S′);  Synchronize(UpdateRunStoryMenuBar);  RunStoryMenuNextSection=5;  end;  15begin  ParamTalk=Toy.Talk(RunStoryPath+′pp005.wav′,′S′);  Synchronize(UpdateRunStoryMenuBar);  RunStoryMenuNextSection=-1;  end;  20begin  ParamTalk=Toy.Talk(RunStoryPath+′pp005.wav′,′S′);  Synchronize(UpdateRunStoryMenuBar);  RunStoryMenuNextSection=10;  end;  25begin  ParamTalk=Toy.Talk(RunStoryPath+′pp00S.wav′,′S′);  Synchronize(UpdateRunStoryMenuBar);  RunStoryMenuNextSection=10;  end;30begin  ParamTalk=Toy.Talk(RunStoryPath+′pp005.wav′,′S′);  Synchronize(UpdateRunStoryMenuBar);  RunStoryMenuNextSection=5;  end;31begin  ParamTalk=Toy.Talk(RunStoryPath+′pp005.wav′,′S′);  Synchronize(UpdateRunStoryMenuBar);  RunStoryMenuNextSection=-1;  end;35begin  ParamTalk=Toy.Talk(RunStoryPath+′pp005.wav′,′S′);  Synchronize(UpdateRunStoryMenuBar);  RunStoryMenuNextSection=10;  end;36begin  ParamTalk=Toy.Talk(RunStoryPath+′pp005.wav′,′S′);  Synchronize(UpdateRunStoryMenuBar);  RunStoryMenuNextSection=10;  end;37begin  ParamTalk=Toy.Talk(RunStoryPath+′pp005.wav′,′S′);  Synchronize(UpdateRunStoryMenuBar);  RunStoryMenuNextSection=5;  end;40begin  ParamTalk=Toy.Talk(RunStoryPath+′pp005.wav′,′S′);  Synchronize(UpdateRunStoryMenuBar);  RunStoryMenuNextSection=-1;  end;45begin  ParamTalk=Toy.Talk(RunStoryPath+′pp005.wav′,′S′);  Synchronize(UpdateRunStoryMenuBar);  RunStoryMenuNextSection=10;end;50begin  ParamTalk=Toy.Talk(RunStoryPath+′PP115.wav′,′S′);  Synchronize(UpdateRunStoryMenuBar);  RunStoryMenuNextSection=10;  end;55begin  ParamTalk=Toy.Talk(RunStoryPath+′pp005.wav′,′S′);  Synchronize(UpdateRunStoryMenuBar);  RunStoryMenuNextSection=5;  end;60begin  ParamTalk=Toy.Talk(RunStoryPath+′pp005.wav′,′S′);  Synchronize(UpdateRunStoryMenuBar);  RunStoryMenuNextSection=-1;  end;65begin  ParamTalk=Toy.Talk(RunStoryPath+′pp005.wav′,′S′);  Synchronize(UpdateRunStoryMenuBar);  RunStoryMenuNextSection=10;  end;70begin  ParamTalk=Toy.Talk(RunStoryPath+′pp005.wav′,′S′);  Synchronize(UpdateRunStoryMenuBar);  RunStoryMenuNextSection=10;  end;75begin  ParamTalk=Toy.Talk(RunStoryPath+′pp005.wav′,′S′);  Synchronize(UpdateRunStoryMenuBar);  RunStoryMenuNextSection=5;  end;80begin  ParamTalk=Toy.Talk(RunStoryPath+′pp005.wav′,′S′);  Synchronize(UpdateRunStoryMenuBar);RunStoryMenuNextSection=-1;  end;85begin  ParamTalk=Toy.Talk(RunStoryPath+′pp005.wav′,′S′);  Synchronize(UpdateRunStoryMenuBar);  RunStoryMenuNextSection=10;  end;90begin  ParamTalk=Toy.Talk(RunStoryPath+′pp005.wav′,′S′);  Synchronize(UpdateRunStoryMenuBar);  RunStoryMenuNextSection=10;  end;95begin  ParamTalk=Toy.Talk(RunStoryPath+′pp005.wav′,′S′);  Synchronize(UpdateRunStoryMenuBar);  RunStoryMenuNextSection=5;  end;100begin  ParamTalk=Toy.Talk(RunStoryPath+′pp005.wav′,′S′);  Synchronize(UpdateRunStoryMenuBar);  RunStoryMenuNextSection=-1;  end;105begin  ParamTalk=Toy.Talk(RunStoryPath+′pp005.wav′,′S′);  Synchronize(UpdateRunStoryMenuBar);  RunStoryMenuNextSection=10;  end;110begin  ParamTalk=Toy.Talk(RunStoryPath+′pp005.wav′,′S′);  Synchronize(UpdateRunStoryMenuBar);  RunStoryMenuNextSection=10;  end;115begin  ParamTalk=Toy.Talk(RunStoryPath+′pp005.wav′,′S′);  Synchronize(UpdateRunStoryMenuBar);RunStoryMenuNextSection=5;  end;120begin  ParamTalk=Toy.Talk(RunStoryPath+′pp005.wav′,′S′);  Synchronize(UpdateRunStoryM=nuBar);  RunStoryMenuNextSection=-1;  end;121begin  ParamTalk=Toy.Talk(RunStoryPath+′pp005.wav′,′S′);  Synchronize(UpdateRunStoryMenuBar);  RunStoryMenuNextSection=10;  end;122begin  ParamTalk=Toy.Talk(RunStoryPath+′pp005.wav′,′S′);  Synchronize(UpdateRunStoryMenuBar);  RunStoryMenuNextSection=10;  end;123begin  ParamTalk=Toy.Talk(RunStoryPath+′pp005.wav′,′S′);  Synchronize(UpdateRunStoryMenuBar);  RunStoryMenuNextSection=10;  end;130begin  ParamTalk=Toy.Talk(RunStoryPath+′pp005.wav′,′S′);  Synchronize(UpdateRunStoryMenuBar);  RunStoryMenuNextSection=-1;  end;135begin  ParamTalk=Toy.Talk(RunStoryPath+′pp005.wav′,′S′);  Synchronize(UpdateRunStoryMenuBar);  RunStoryMenuNextSection=10;  end;140begin  ParamTalk=Toy.Talk(RunStoryPath+′pp005.wav′,′S′);  Synchronize(UpdateRunStoryMenuBar);RunStoryMenuNextSection=10;  end;145begin  ParamTalk=Toy.Talk(RunStoryPath+′pp005.wav′,′S′);  Synchronize(UpdateRunStoryMenuBar);  RunStoryMenuNextSection=5;  end;150begin  ParamTalk=Toy.Talk(RunStoryPath+′pp005.wav′,′S′);  Synchronize(UpdateRunStoryMenuBar);  RunStoryMenuNextSection=-1;  end;155begin  ParamTalk=Toy.Talk(RunStoryPath+′pp005.wav′,′S′);  Synchronize(UpdateRunStoryMenuBar);  RunStoryMenuNextSection=10;  end;160begin  ParamTalk=Toy.Talk(RunStoryPath+′pp005.wav′,′S′);  Synchronize(UpdateRunStoryMenuBar);  RunStoryMenuNextSection=10;  end;165begin  ParamTalk=Toy.Talk(RunStoryPath+′pp00S.wav′,′S′);  Synchronize(UpdateRunStoryMenuBar);  RunStoryMenuNextSection=10;  end;170begin  ParamTalk=Toy.Talk(RunStoryPath+′pp005.wav′,′S′);  Synchronize(UpdateRunStoryMenuBar);  RunStoryMenuNextSection=5;  end;175begin  ParamTalk=Toy.Talk(RunStoryPath+′pp005.wav′,′S′);Synchronize(UpdateRunStoryMenuBar);  RunStoryMenuNextSection=-1;  end;180begin  ParamTalk=Toy.Talk(RunStoryPath+′pp005.wav′,′S′);  Synchronize(UpdateRunStoryMenuBar);  RunStoryMenuNextSection=10;  end;185begin  ParamTalk=Toy.Talk(RunStoryPath+′pp005.wav′,′S′);  Synchronize(UpdateRunStoryMenuBar);  RunStoryMenuNextSection=10;  end;190begin  ParamTalk=Toy.Talk(RunStoryPath+′pp005.wav′,′S′);  Synchronize(UpdateRunStoryMenuBar);  RunStoryMenuNextSection=10;  end;end;//----------------endof"Run-StoryMenu"sesions------------//=======Bunny====================//-------------writehereallsessions------------------------//===============================  caseBunnyNextSectionof  1begin  {sleep(300);  ParamTalk=Toy.Talk(BunnyPath+′in001.wav′,′E′);  ParamListen=Toy.Listen(′yes/1,no,2′,1.5,′SRandSensor′);}  BunnyNextSection=5;  end;  5begin  ParamTalk=Toy.Talk(BunnyPath+′rb005.wav′,′S′);  Synchronize(UpdateBunnyBar);  BunnyNextSection=10;  end;10begin  ParamTalk=Toy.Talk(BunnyPath+′pp005.wav′,′S′);  Synchronize(UpdateBunnyBar);  BunnyNextSection=5;  end;15begin  ParamTalk=Toy.Talk(BunnyPath+′pp005.wav′,′S′);  Synchronize(UpdateBunnyBar);  BunnyNextSection=-1;  end;25begin  ParamTalk=Toy.Talk(BunnyPath+′pp005.wav′,′S′);  Synchronize(UpdateBunnyBar);  BunnyNextSection=10;  end;26begin  ParamTalk=Toy.Talk(BunnyPath+′pp005.wav′,′S′);  Synchronize(UpdateBunnyBar);  BunnyNextSection=10;  end;301begin  ParamTalk=Toy.Talk(BunnyPath+′pp005.wav′,′S′);  Synchronize(UpdateBunnyBar);  BunnyNextSection=5;  end;302begin  ParamTalk=Toy.Talk(BunnyPath+′pp005.wav′,′S′);  Synchronize(UpdateBunnyBar);  BunnyNextSection=-1;  end;303begin  ParamTalk=Toy.Talk(BunnyPath+′pp005.wav′,′S′);  Synchronize(UpdateBunnyBar);  BunnyNextSection=10;  end;40begin  ParamTalk=Toy.Talk(BunnyPath+′pp005.wav′,′S′);  Synchronize(UpdateBunnyBar);  BunnyNextSection=-1;  end;  45begin  ParamTalk=Toy.Talk(BunnyPath+′pp005.wav′,′S′);  Synchronize(UpdateBunnyBar);  BunnyNextSection=10;  end;  50begin  ParamTalk=Toy.Talk(BunnyPath+′pp005.wav′,′S′);  Synchronize(UpdateBunnyBar);  BunnyNextSection=10;  end;  55begin  ParamTalk=Toy.Talk(BunnyPath+′pp005.wav′,′S′);//choosein551-553  Synchronize(UpdateBunnyBar);  BunnyNextSection=5;  end;  60begin  ParamTalk=Toy.Talk(BunnyPath+′pp005.wav′,′S′);  Synchronize(UpdateBunnyBar);  BunnyNextSection=-1;  end;  65begin  ParamTalk=Toy.Talk(BunnyPath+′pp005.wav′,′S′);  Synchronize(UpdateBunnyBar);  BunnyNextSection=10;  end;  70begin  ParamTalk=Toy.Talk(BunnyPath+′pp005.wav′,′S′);  Synchronize(UpdateBunnyBar);  BunnyNextSection=10;  end;75begin  ParamTalk=Toy.Talk(BunnyPath+′pp00S.wav′,′S′);//choosein751-753  Synchronize(UpdateBunnyBar);  BunnyNextSection=5;  end;  80begin  ParamTalk=Toy.Talk(BunnyPath+′pp005.wav′,′S′);  Synchronize(UpdateBunnyBar);  BunnyNextSection=-1;  end;  85begin  ParamTalk=Toy.Talk(BunnyPath+′pp005.wav′,′S′);//choosein851-853  Synchronize(UpdateBunnyBar);  BunnyNextSection=10;  end;  90begin  ParamTalk=Toy.Talk(BunnyPath+′pp005.wav′,′S′);  Synchronize(UpdateBunnyBar);  BunnyNextSection=10;  end;  100begin  ParamTalk=Toy.Talk(BunnyPath+′pp005.wav′,′S′);//choosein1001-1003  Synchronize(UpdateBunnyBar);  BunnyNextSection=-1;  end;  105begin  ParamTalk=Toy.Talk(BunnyPath+′pp005.wav′,′S′);  Synchronize(UpdateBunnyBar);  BunnyNextSection=10;  end;110begin  ParamTalk=Toy.Talk(BunnyPath+′pp005.wav′,′S′);  Synchronize(UpdateBunnyBar);  BunnyNextSection=10;  end;  115begin  ParamTalk=Toy.Talk(BunnyPath+′pp005.wav′,′S′);  Synchronize(UpdateBunnyBar);  BunnyNextSection=5;  end;  120begin  ParamTalk=Toy.Talk(BunnyPath+′pp005.wav′,′S′  Synchronize(UpdateBunnyBar);  BunnyNextSection=-1;  end;  125begin  ParamTalk=Toy.Talk(BunnyPath+′pp005.wav′,′S′);  Synchronize(UpdateBunnyBar);  BunnyNextSection=10;  end;  130begin  ParamTalk=Toy.Talk(BunnyPath+′pp005.wav′,′S′);  Synchronize(UpdateBunnyBar);  BunnyNextSection=10;  end;  135begin  ParamTalk=Toy.Talk(BunnyPath+′pp005.wav′,′S′);//choosein1351-1353  Synchronize(UpdateBunnyBar);  BunnyNextSection=5;  end;  150begin  ParamTalk=Toy.Talk(BunnyPath+′pp005.wav′,′S′);  Synchronize(UpdateBunnyBar);BunnyNextSection=10;  end;  155begin  ParamTalk=Toy.Talk(BunnyPath+′pp005.wav′,′S′  Synchronize(UpdateBunnyBar);  BunnyNextSection=5;  end;  160begin  ParamTalk=Toy.Talk(BunnyPath+′pp005.wav′,′S′);  Synchronize(UpdateBunnyBar);  BunnyNextSection=-1;  end;  165begin  ParamTalk=Toy.Talk(BunnyPath+′pp005.wav′,′S′);  Synchronize(UpdateBunnyBar);  BunnyNextSection=10;  end;  166begin  ParamTalk=Toy.Talk(BunnyPath+′pp005.wav′,′S′);  Synchronize(UpdateBunnyBar);  BunnyNextSection=10;  end;  171begin  ParamTalk=Toy.Talk(BunnyPath+′pp005.wav′,′S′);  Synchronize(UpdateBunnyBar);  BunnyNextSection=5;  end;  180begin  ParamTalk=Toy.Talk(BunnyPath+′pp005.wav′,′S′);//choosein1802-18010  Synchronize(UpdateBunnyBar);  BunnyNextSection=10;  end;  185beginParamTalk=Toy.Talk(BunnyPath+′pp005.wav′  Synchronize(UpdateBunnyBar);  BunnyNextSection=10;  end;  190begin  ParamTalk=Toy.Talk(BunnyPath+′pp005.wav′,′S′);//choosein1901-1903  Synchronize(UpdateBunnyBar);  BunnyNextSection=5;  end;  195begin  ParamTalk=Toy.Talk(BunnyPath+′pp005.wav′,′S′);  Synchronize(UpdateBunnyBar);  BunnyNextSection=-1;  end;  200begin  ParamTalk=Toy.Talk(BunnyPath+′pp005.wav′,′S′);  Synchronize(UpdateBunnyBar);  BunnyNextSection=10;  end;  205begin   ParamTalk=Toy.Talk(BunnyPath+′pp005.wav′,′S′);  Synchronize(UpdateBunnyBar);  BunnyNextSection=10;  end;  220begin  ParamTalk=Toy.Talk(BunnyPath+′pp005.wav′,′S′);  Synchronize(UpdateBunnyBar);  BunnyNextSection=10;  end;  225begin  ParamTalk=Toy.Talk(BunnyPath+′pp005.wav′,′S′);//choosein2251-2253  Synchronize(UpdateBunnyBar);  BunnyNextSection=10;  end;230begin  ParamTalk=Toy.Talk(BunnyPath+′pp005.wav′,′S′);  Synchronize(UpdateBunnyBar);  BunnyNextSection=-1;  end;  235begin  ParamTalk=Toy.Talk(BunnyPath+′pp005.wav′,′S′);  Synchronize(UpdateBunnyBar);  BunnyNextSection=10;  end;  240begin  ParamTalk=Toy.Talk(BunnyPath+′pp005.wav′,′S′);  Synchronize(UpdateBunnyBar);  BunnyNextSection=10;  end;  245begin  ParamTalk=Toy.Talk(BunnyPath+′pp005.wav′,′S′);  Synchronize(UpdateBunnyBar);  BunnyNextSection=5;  end;  250begin  ParamTalk=Toy.Talk(BunnyPath+′pp005.wav′,′S′);  Synchronize(UpdateBunnyBar);  BunnyNextSection=-1;  end;  255begin  ParamTalk=Toy.Talk(BunnyPath+′pp005.wav′,′S′);//choosein2551-25510  Synchronize(UpdateBunnyBar);  BunnyNextSection=10;  end;  260begin  ParamTalk=Toy.Talk(BunnyPath+′pp005.wav′,′S′);  Synchronize(UpdateBunnyBar);  BunnyNextSection=10;  end;265begin  ParamTalk=Toy.Talk(BunnyPath+′pp005.wav′,′S′);//choosein2651-2653  Synchronize(UpdateBunnyBar);  BunnyNextSection=5;  end;  270begin  ParamTalk=Toy.Talk(BunnyPath+′pp005.wav′,′S′);  Synchronize(UpdateBunnyBar);  BunnyNextSection=-1;  end;  275begin  ParamTalk=Toy.Talk(BunnyPath+′pp005.wav′,′S′);//choosein2751-2753  Synchronize(UpdateBunnyBar);  BunnyNextSection=10;  end;  280begin  ParamTalk=Toy.Talk(BunnyPath+′pp005.wav′,′S′);  Synchronize(UpdateBunnyBar);  BunnyNextSection=10;  end;  285begin  ParamTalk=Toy.Talk(BunnyPath+′pp005.wav′,′S′);  Synchronize(UpdateBunnyBar);  BunnyNextSection=5;  end;  290begin  ParamTalk=Toy.Talk(BunnyPath+′pp005.wav′,′S′);//choosein2901-2903  Synchronize(UpdateBunnyBar);  BunnyNextSection=-1;  end;  295begin  ParamTalk=Toy.Talk(BunnyPath+′pp005.wav′,′S′);Synchronize(UpdateBunnyBar);  BunnyNextSection=10;  end;296begin  ParamTalk=Toy.Talk(BunnyPath+′pp005.wav′,′S′);//choosein2961-2963  Synchronize(UpdateBunnyBar);  BunnyNextSection=10;  end;300begin  ParamTalk=Toy.Talk(BunnyPath+′pp005.wav′,′S′);  Synchronize(UpdateBunnyBar);  BunnyNextSection=10;  end;305begin  ParamTalk=Toy.Talk(BunnyPath+′pp005.wav′,′S′);//choosein3051-3053  Synchronize(UpdateBunnyBar);  BunnyNextSection=5;  end;315begin  ParamTalk=Toy.Talk(BunnyPath+′pp005.wav′,′S′);  Synchronize(UpdateBunnyBar);  BunnyNextSection=10;  end;320begin  ParamTalk=Toy.Talk(BunnyPath+′pp005.wav′,′S′);  Synchronize(UpdateBunnyBar);  BunnyNextSection=10;  end;330begin  ParamTalk=Toy.Talk(BunnyPath+′pp005.wav′,′S′);  Synchronize(UpdateBunnyBar);  BunnyNextSection=10;  end;335begin  ParamTalk=Toy.Talk(BunnyPath+′pp005.wav′,′S′);  Synchronize(UpdateBunnyBar);  BunnyNextSection=5;  end;345begin  ParamTalk=Toy.Talk(BunnyPath+′pp005.wav′,′S′);  Synchronize(UpdateBunnyBar);  BunnyNextSection=10;  end;350begin  ParamTalk=Toy.Talk(BunnyPath+′pp005.wav′,′S′);  Synchronize(UpdateBunnyBar);  BunnyNextSection=5;  end;355begin  ParamTalk=Toy.Talk(BunnyPath+′pp005.wav′,′S′);  Synchronize(UpdateBunnyBar);  BunnyNextSection=5;  end;360begin  ParamTalk=Toy.Talk(BunnyPath+′pp005.wav′,′S′);  Synchronize(UpdateBunnyBar);  BunnyNextSection=5;  end;365begin  ParamTalk=Toy.Talk(BunnyPath+′pp005.wav′,′S′);  Synchronize(UpdateBunnyBar);  BunnyNextSection=5;   end;370begin  ParamTalk=Toy.Talk(BunnyPath+′pp005.wav′,′S′);  Synchronize(UpdateBunnyBar);  BunnyNextSection=5;  end;375begin  ParamTalk=Toy.Talk(BunnyPath+′pp005.wav′′S′);  Synchronize(UpdateBunnyBar);  BunnyNextSection=5;  end;380begin  ParamTalk=Toy.Talk(BunnyPath+′pp005.wav′′S′);  Synchronize(UpdateBunnyBar);  BunnyNextSection=5;  end;382begin  ParamTalk=Toy.Talk(BunnyPath+′pp005.wav′′S′);  Synchronize(UpdateBunnyBar);  BunnyNextSection=5;  end;385begin  ParamTalk=Toy.Talk(BunnyPath+′pp005.wav′′S′);  Synchronize(UpdateBunnyBar);  BunnyNextSection=5;  end;390begin  ParamTalk=Toy.Talk(BunnyPath+′pp005.wav′′S′);  Synchronize(UpdateBunnyBar);  BunnyNextSection=5;  end;395begin  ParamTalk=Toy.Talk(BunnyPath+′pp005.wav′,′S′);  Synchronize(UpdateBunnyBar);  BunnyNextSection=5;  end;400begin  ParamTalk=Toy.Talk(BunnyPath+′pp005.wav′′S′);  Synchronize(UpdateBunnyBar);  BunnyNextSection=-1;  end;405beginParamTalk=Toy.Talk(BunnyPath+′pp005.wav′  Synchronize(UpdateBunnyBar);  BunnyNextSection=10;  end;  410begin  ParamTalk=Toy.Talk(BunnyPath+′pp005.wav′,′S′);  Synchronize(UpdateBunnyBar);  BunnyNextSection=10;  end;  415begin  ParamTalk=Toy.Talk(BunnyPath+′pp005.wav′,′S′);//choosein4151-4153  Synchronize(UpdateBunnyBar);  BunnyNextSection=10;  end;  420begin  ParamTalk=Toy.Talk(BunnyPath+′pp005.wav′,′S′);//choosein4201-4203  Synchronize(UpdateBunnyBar);  BunnyNextSection=10;  end;  425begin  ParamTalk=Toy.Talk(BunnyPath+′pp005.wav′,′S′);  Synchronize(UpdateBunnyBar);  BunnyNextSection=5;  end;  435begin  ParamTalk=Toy.Talk(BunnyPath+′pp005.wav′,′S′);  Synchronize(UpdateBunnyBar);  BunnyNextSection=10;  end;  440begin  ParamTalk=Toy.Talk(BunnyPath+′pp005.wav′,′S′);  Synchronize(UpdateBunnyBar);  BunnyNextSection=10;  end;445begin  ParamTalk=Toy.Talk(BunnyPath+′pp005.wav′,′S′);  Synchronize(UpdateBunnyBar);  BunnyNextSection=5;  end;  {else  begin  Terminate;  Exit;  end;}  end;//----------------endof"Bunny"sesions-----------------//========Grouchy=================//--------------writehereallsessions---------------------//=============================  caseGrouchyNextSectionof  1begin  {sleep(300);  ParamTalk=Toy.Talk(GrouchyPath+′in001.wav′,′E′);  ParamTisten=Toy.Listen(′yes/1,no,2′,1.5,′SRandSensor′);}  GrouchyNextSection=5;  end;  5begin  ParamTalk=Toy.Talk(GrouchyPath+′pp005.wav′,′S′);  Synchronize(UpdateGrouchyBar);  GrouchyNextSection=10;  end;  10begin  ParamTalk=Toy.Talk(GrouchyPath+′pp005.wav′,′S′);  Synchronize(UpdateGrouchyBar);  GrouchyNextSection=5;  end;  15beginParamTalk=Toy.Talk(GrouchyPath+′pp005.wav′,′S′);  Synchronize(UpdateGrouchyBar);  GrouchyNextSection=-1;  end;20begin  ParamTalk=Toy.Talk(GrouchyPath+′pp005.wav′,′S′);  Synchronize(UpdateGrouchyBar);  GrouchyNextSection=10;  end;25begin  ParamTalk=Toy.Talk(GrouchyPath+′pp005.wav′,′S′);  Synchronize(UpdateGrouchyBar);  GrouchyNextSection=10;  end;30begin  ParamTalk=Toy.Talk(GrouchyPath+′pp005.wav′,′S′);  Synchronize(UpdateGrouchyBar);  GrouchyNextSection=5;  end;31begin  ParamTalk=Toy.Talk(GrouchyPath+′pp005.wav′,′S′);  Synchronize(UpdateGrouchyBar);  GrouchyNextSection=-1;  end;35begin  ParamTalk=Toy.Talk(GrouchyPath+′pp005.wav′,′S′);  Synchronize(UpdateGrouchyBar);  GrouchyNextSection=10;  end;36begin  ParamTalk=Toy.Talk(GrouchyPath+′pp005.wav′,′S′);  Synchronize(UpdateGrouchyBar);  GrouchyNextSection=10;  end;37beginParamTalk=Toy.Talk(GrouchyPath+′pp005.wav′,′S′);  Synchronize(UpdateGrouchyBar);  GrouchyNextSection=5;  end;40begin  ParamTalk=Toy.Talk(GrouchyPath+′pp005.wav′,′S′);  Synchronize(UpdateGrouchyBar);  GrouchyNextSection=-1;  end;45begin  ParamTalk=Toy.Talk(GrouchyPath+′pp005.wav′,′S′);  Synchronize(UpdateGrouchyBar);  GrouchyNextSection=10;  end;50begin  ParamTalk=Toy.Talk(GrouchyPath+′pp005.wav′,′S′);  Synchronize(UpdateGrouchyBar);  GrouchyNextSection=10;  end;55begin  ParamTalk=Toy.Talk(GrouchyPath+′pp005.wav′,′S′);  Synchronize(UpdateGrouchyBar);  GrouchyNextSection=5;  end;60begin  ParamTalk=Toy.Talk(GrouchyPath+′pp005.wav′,′S′);  Synchronize(UpdateGrouchyBar);  GrouchyNextSection=-1;  end;65begin  ParamTalk=Toy.Talk(GrouchyPath+′pp005.wav′,′S′);  Synchronize(UpdateGrouchyBar);  GrouchyNextSection=10;  end;70begin  ParamTalk=Toy.Talk(GrouchyPath+′pp005.wav′,′S′);  Synchronize(UpdateGrouchyBar);  GrouchyNextSection=10;  end;75begin  ParamTalk=Toy.Talk(GrouchyPath+′pp005.wav′,′S′);  Synchronize(UpdateGrouchyBar);  GrouchyNextSection=5;  end;80begin  ParamTalk=Toy.Talk(GrouchyPath+′pp005.wav′,′S′);  Synchronize(UpdateGrouchyBar);  GrouchyNextSection=-1;  end;85begin  ParamTalk=Toy.Talk(GrouchyPath+′pp005.wav′,′S′);  Synchronize(UpdateGrouchyBar);  GrouchyNextSection=10;  end;90begin  ParamTalk=Toy.Talk(GrouchyPath+′pp005.wav′,′S′);  Synchronize(UpdateGrouchyBar);  GrouchyNextSection=10;  end;95begin  ParamTalk=Toy.Talk(GrouchyPath+′pp005.wav′,′S′);  Synchronize(UpdateGrouchyBar);  GrouchyNextSection=5;  end;100begin  ParamTalk=Toy.Talk(GrouchyPath+′pp005.wav′,′S′);  Synchronize(UpdateGrouchyBar);  GrouchyNextSection=-1;  end;105begin  ParamTalk=Toy.Talk(GrouchyPath+′pp005.wav′,′S′);  Synchronize(UpdateGrouchyBar);  GrouchyNextSection=10;  end;110begin  ParamTalk=Toy.Talk(GrouchyPath+′pp005.wav′,′S′);  Synchronize(UpdateGrouchyBar);  GrouchyNextSection=10;  end;115begin  ParamTalk=Toy.Talk(GrouchyPath+′pp005.wav′,′S′);  Synchronize(UpdateGrouchyBar);  GrouchyNextSection=5;  end;120begin  ParamTalk=Toy.Talk(GrouchyPath+′pp005.wav′,′S′);  Synchronize(UpdateGrouchyBar);  GrouchyNextSection=-1;  end;125begin  ParamTalk=Toy.Talk(GrouchyPath+′pp005.wav′,′S′);  Synchronize(UpdateGrouchyBar);  GrouchyNextSection=10;  end;130begin  ParamTalk=Toy.Talk(GrouchyPath+′pp005.wav′,′S′);  Synchronize(UpdateGrouchyBar);  GrouchyNextSection=10;  end;135begin  ParamTalk=Toy.Talk(GrouchyPath+′pp005.wav′,′S′);  Synchronize(UpdateGrouchyBar);  GrouchyNextSection=5;  end;140begin  ParamTalk=Toy.Talk(GrouchyPath+′pp005.wav′,′S′);  Synchronize(UpdateGrouchyBar);  GrouchyNextSection=-1;  end;145begin  ParamTalk=Toy.Talk(GrouchyPath+′pp005.wav′,′S′);  Synchronize(UpdateGrouchyBar);  GrouchyNextSection=10;  end;150begin  ParamTalk=Toy.Talk(GrouchyPath+′pp005.wav′,′S′);  Synchronize(UpdateGrouchyBar);  GrouchyNextSection=10;  end;155begin  ParamTalk=Toy.Talk(GrouchyPath+′pp005.wav′,′S′);  Synchronize(UpdateGrouchyBar);  GrouchyNextSection=5;  end;160begin  ParamTalk=Toy.Talk(GrouchyPath+′pp005.wav′,′S′);  Synchronize(UpdateGrouchyBar);  GrouchyNextSection=-1;  end;165begin  ParamTalk=Toy.Talk(GrouchyPath+′pp005.wav′,′S′);  Synchronize(UpdateGrouchyBar);  GrouchyNextSection=10;  end;170begin  ParamTalk=Toy.Talk(GrouchyPath+′pp005.wav′,′S′);  Synchronize(UpdateGrouchyBar);  GrouchyNextSection=10;  end;171begin  ParamTalk=Toy.Talk(GrouchyPath+′pp005.wav′,′S′);  Synchronize(UpdateGrouchyBar);  GrouchyNextSection=5;  end;175begin  ParamTalk=Toy.Talk(GrouchyPath+′pp005.wav′,′S′);  Synchronize(UpdateGrouchyBar);  GrouchyNextSection=-1;  end;180begin  ParamTalk=Toy.Talk(GrouchyPath+′pp005.wav′,′S′);  Synchronize(UpdateGrouchyBar);  GrouchyNextSection=10;  end;185begin  ParamTalk=Toy.Talk(GrouchyPath+′pp005.wav′,′S′);  Synchronize(UpdateGrouchyBar);  GrouchyNextSection=10;  end;190begin  ParamTalk=Toy.Talk(GrouchyPath+′pp005.wav′,′S′);  Synchronize(UpdateGrouchyBar);  GrcuchyNextSection=5;  end;195begin  ParamTalk=Toy.Talk(GrouchyPath+′pp005.wav′,′S′);  Synchronize(UpdateGrouchyBar);  GrouchyNextSection=-1;  end;200begin  ParamTalk=Toy.Talk(GrouchyPath+′pp005.wav′,′S′);  Synchronize(UpdateGrouchyBar);  GrouchyNextSection=10;  end;205begin  ParamTalk=Toy.Talk(GrouchyPath+′pp005.wav′,′S′);  Synchronize(UpdateGrouchyBar);  GrouchyNextSection=10;  end;210begin  ParamTalk=Toy.Talk(GrouchyPath+′pp005.wav′,′S′);  Synchronize(UpdateGrouchyBar);  GrouchyNextSection=5;  end;215begin  ParamTalk=Toy.Talk(GrouchyPath+′pp005.wav′,′S′);  Synchronize(UpdateGrouchyBar);  GrouchyNextSection=-1;  end;220begin  ParamTalk=Toy.Talk(GrouchyPath+′pp005.wav′,′S′);  Synchronize(UpdateGrouchyBar);  GrouchyNextSection=10;  end;225begin  ParamTalk=Toy.Talk(GrouchyPath+′pp005.wav′,′S′);  Synchronize(UpdateGrouchyBar);  GrouchyNextSection=10;  end;226begin  ParamTalk=Toy.Talk(GrouchyPath+′pp005.wav′,′S′);  Synchronize(UpdateGrouchyBar);  GrouchyNextSection=5;  end;230begin    ParamTalk=Toy.Talk(GrouchyPath+′pp005.wav′,′S′);  Synchronize(UpdateGrouchyBar);  GrouchyNextSection=-1;  end;235begin  ParamTalk=Toy.Talk(GrouchyPath+′pp005.wav′,′S′);  Synchronize(UpdateGrouchyBar);  GrouchyNextSection=10;  end;240begin  ParamTalk=Toy.Talk(GrouchyPath+′pp005.wav′,′S′);  Synchronize(UpdateGrouchyBar);  GrouchyNextSection=10;  end;245begin  ParamTalk=Toy.Talk(GrouchyPath+′pp005.wav′,′S′;  Synchronize(UpdateGrouchyBar);  GrouchyNextSection=5;  end;250begin  ParamTalk=Toy.Talk(GrouchyPath+′pp005.wav′,′S′);  Synchronize(UpdateGrouchyBar);  GrouchyNextSection=-1;  end;255begin  ParamTalk=Toy.Talk(GrouchyPath+′pp005.wav′,′S′);  Synchronize(UpdateGrouchyBar);  GrouchyNextSection=10;  end;260begin  ParamTalk=Toy.Talk(GrouchyPath+′pp005.wav′,′S′);  Synchronize(UpdateGrouchyBar);  GrouchyNextSection=10;  end;265begin  ParamTalk=Toy.Talk(GrouchyPath+′pp005.wav′,′S′);  Synchronize(UpdateGrouchyBar);  GrouchyNextSection=5;  end;270begin  ParamTalk=Toy.Talk(GrouchyPath+′pp005.wav′,′S′);  Synchronize(UpdateGrouchyBar);  GrouchyNextSection=-1;  end;275begin  ParamTalk=Toy.Talk(GrouchyPath+′pp005.wav′,′S′);  Synchronize(UpdateGrouchyBar);  GrouchyNextSection=10;  end;  {else  begin  Terminate;  Exit;  end;}  end;//------------endof"Grouchy"sesions--------------------//======BedTimeRitual===============//----------writehereallsessions------------------------//============================  caseBedTimeRitualNextSectionof  1begin  {sleep(300);  ParamTalk=Toy.Talk(BedTimePath+′in001.wav′,′E′);  ParamListen=Toy.Listen(′yes/1,no,2′,1.5,′SRandSensor′);}  BedTimeRitualNextSection=5;  end;  5begin  ParamTalk=Toy.Talk(BedTimePath+′pp005.wav′,′S′);  Synchronize(UpdateBedTimeRitualBar);  BedTimeRitualNextSection=10;  end;  10begin  ParamTalk=Toy.Talk(BedTimePath+′pp005.wav′,′S′);  Synchronize(UpdateBedTimeRitualBar);BedTimeRitualNextSection=5;  end;15begin  ParamTalk=Toy.Talk(BedTimePath+′pp005.wav′,′S′);  Synchronize(UpdateBedTimeRitualBar);  BedTimeRitualNextSection=-1;  end;20begin  ParamTalk=Toy.Talk(BedTimePath+′pp005.wav′,′S′);  Synchronize(UpdateBedTimeRitualBar);  BedTimeRitualNextSection=10;  end;25begin  ParamTalk=Toy.Talk(BedTimePath+′pp005.wav′,′S′);  Synchronize(UpdateBedTimeRitualBar);  BedTimeRitualNextSection=10;  end;30begin  ParamTalk=Toy.Talk(BedTimePath+′pp005.wav′,′S′);  Synchronize(UpdateBedTimeRitualBar);  BedTimeRitualNextSection=5;  end;31begin  ParamTalk=Toy.Talk(BedTimePath+′pp005.wav′,′S′);  Synchronize(UpdateBedTimeRitualBar);  BedTimeRitualNextSection=-1;  end;35begin  ParamTalk=Toy.Talk(BedTimePath+′pp005.wav′,′S′);  Synchronize(UpdateBedTimeRitualBar);  BedTimeRitualNextSection=10;  end;36begin  ParamTalk=Toy.Talk(BedTimePath+′pp005.wav′,′S′);Synchronize(UpdateBedTimeRitualBar);  BedTimeRitualNextSection=10;  end;37begin  ParamTalk=Toy.Talk(BedTimePath+′pp005.wav′,′S′);  Synchronize(UpdateBedTimeRitualBar);  BedTimeRitualNextSection=5;  end;40begin  ParamTalk=Toy.Talk(BedTimePath+′pp005.wav′,′S′);  Synchronize(UpdateBedTimeRitualBar);  BedTimeRitualNextSection=-1;  end;45begin  ParamTalk=Toy.Talk(BedTimePath+′pp005.wav′,′S′);  Synchronize(UpdateBedTimeRitualBar);  BedTimeRitualNextSection=10;  end;50begin  ParamTalk=Toy.Talk(BedTimePath+′pp005.wav′,′S′);  Synchronize(UpdateBedTimeRitualBar);  BedTimeRitualNextSection=10;  end;55begin  ParamTalk=Toy.Talk(BedTimePath+′pp005.wav′,′S′);  Synchronize(UpdateBedTimeRitualBar);  BedTimeRitualNextSection=5;  end;60begin  ParamTalk=Toy.Talk(BedTimePath+′pp005.wav′,′S′);  Synchronize(UpdateBedTimeRitualBar);  BedTimeRitualNextSection=-1;  end;65beginParamTalk=Toy.Talk(BedTimePath+′pp005.wav′,′S′);  Synchronize(UpdateBedTimeRitualBar);  BedTimeRitualNextSection=10;  end;70begin  ParamTalk=Toy.Talk(BedTimePath+′pp005.wav′,′S′);  Synchronize(UpdateBedTimeRitualBar);  BedTimeRitualNextSection=10;  end;75begin  ParamTalk=Toy.Talk(BedTimePath+′pp005.wav′,′S′);  Synchronize(UpdateBedTimeRitualBar);  BedTimeRitualNextSection=5;  end;80begin  ParamTalk=Toy.Talk(BedTimePath+′pp005.wav′,′S′);  Synchronize(UpdateBedTimeRitualBar);  BedTimeRitualNextSection=-1;  end;85begin  ParamTalk=Toy.Talk(BedTimePath+′pp005.wav′,′S′);  Synchronize(UpdateBedTimeRitualBar);  BedTimeRitualNextSection=10;  end;90begin  ParamTalk=Toy.Talk(BedTimePath+′pp005.wav′,′S′);  Synchronize(UpdateBedTimeRitualBar);  BedTimeRitualNextSection=10;  end;95begin  ParamTalk=Toy.Talk(BedTimePath+′pp005.wav′,′S′);  Synchronize(UpdateBedTimeRitualBar);  BedTimeRitualNextSection=5;  end;100begin  ParamTalk=Toy.Talk(BedTimePath+′pp005.wav′,′S′);  Synchronize(UpdateBedTimeRitualBar);  BedTimeRitualNextSection=-1;  end;105begin  ParamTalk=Toy.Talk(BedTimePath+′pp005.wav′,′S′);  Synchronize(UpdateBedTimeRitualBar);  BedTimeRitualNextSection=10;  end;110begin  ParamTalk=Toy.Talk(BedTimePath+′pp005.wav′,′S′);  Synchronize(UpdateBedTimeRitualBar);  BedTimeRitualNextSection=10;  end;115begin  ParamTalk=Toy.Talk(BedTimePath+′pp005.wav′,′S′);  Synchronize(UpdateBedTimeRitualBar);  BedTimeRitualNextSection=5;  end;120begin  ParamTalk=Toy.Talk(BedTimePath+′pp005.wav′,′S′);  Synchronize(UpdateBedTimeRitualBar);  BedTimeRitualNextSection=-1;  end;125begin  ParamTalk=Toy.Talk(BedTimePath+′pp005.wav′,′S′);  Synchronize(UpdateBedTimeRitualBar);  BedTimeRitualNextSection=10;  end;130begin  ParamTalk=Toy.Talk(BedTimePath+′pp005.wav′,′S′);  Synchronize(UpdateBedTimeRitualBar);  BedTimeRitualNextSection=10;  end;135begin  ParamTalk=Toy.Talk(BedTimePath+′pp005.wav′,′S′);  Synchronize(UpdateBedTimeRitualBar);  BedTimeRitualNextSection=5;  end;140begin  ParamTalk=Toy.Talk(BedTimePath+′pp005.wav′,′S′);  Synchronize(UpdateBedTimeRitualBar);  BedTimeRitualNextSection=-1;  end;145begin  ParamTalk=Toy.Talk(BedTimePath+′pp005.wav′,′S′);  Synchronize(UpdateBedTimeRitualBar);  BedTimeRitualNextSection=10;  end;150begin  ParamTalk=Toy.Talk(BedTimePath+′pp005.wav′,′S′);  Synchronize(UpdateBedTimeRitualBar);  BedTimeRitualNextSection=10;  end;155begin  ParamTalk=Toy.Talk(BedTimePath+′pp005.wav′,′S′);  Synchronize(UpdateBedTimeRitualBar);  BedTimeRitualNextSection=5;  end;160begin  ParamTalk=Toy.Talk(BedTimePath+′pp005.wav′,′S′);  Synchronize(UpdateBedTimeRitualBar);  BedTimeRitualNextSection=-1;  end;165begin  ParamTalk=Toy.Talk(BedTimePath+′pp005.wav′,′S′);  Synchronize(UpdateBedTimeRitualBar);  BedTimeRitualNextSection=10;  end;170begin ParamTalk=Toy.Talk(BedTimePath+′pp005.wav′,′S′);  Synchronize(UpdateBedTimeRitualBar);  BedTimeRitualNextSection=10;  end;171begin  ParamTalk=Toy.Talk(BedTimePath+′pp005.wav′,′S′);  Synchronize(UpdateBedTimeRitualBar);  BedTimeRitualNextSection=5;  end;175begin  ParamTalk=Toy.Talk(BedTimePath+′pp005.wav′,′S′);  Synchronize(UpdateBedTimeritualBar);  BedTimeRitualNextSection=-1;  end;180begin  ParamTalk=Toy.Talk(BedTimePath+′pp005.wav′,′S′);  Synchronize(UpdateBedTimeRitualBar);  BedTimeRitualNextSection=10;  end;185begin  ParamTalk=Toy.Talk(BedTimePath+′pp005.wav′,′S′);  Synchronize(UpdateBedTimeRitualBar);  BedTimeRitualNextSection=10;  end;190begin  ParamTalk=Toy.Talk(BedTimePath+′pp005.wav′,′S′);  Synchronize(UpdateBedTimeRitualBar);  BedTimeRitualNextSection=5;  end;195begin  ParamTalk=Toy.Talk(BedTimePath+′pp005.wav′,′S′);  Synchronize(UpdateBedTimeRitualBar);  BedTimeRitualNextSection=-1;  end;200begin  ParamTalk=Toy.Talk(BedTimePath+′pp005.wav′,′S′);  Synchronize(UpdateBedTimeRitualBar);  BedTimeRitualNextSection=10;  end;205begin  ParamTalk=Toy.Talk(BedTimePath+′pp005.wav′,′S′);  Synchronize(UpdateBedTimeRitualBar);  BedTimeRitualNextSection=10;  end;210begin  ParamTalk=Toy.Talk(BedTimePath+′pp005.wav′,′S′);  Synchronize(UpdateBedTimeRitualBar);  BedTimeRitualNextSection=5;  end;215begin  ParamTalk=Toy.Talk(BedTimePath+′pp005.wav′,′S′);  Synchronize(UpdateBedTimeRitualBar);  BedTimeRitualNextSection=-1;  end;220begin  ParamTalk=Toy.Talk(BedTimePath+′pp005.wav′,′S′);  Synchronize(UpdateBedTimeRitualBar);  BedTimeRitualNextSection=10;  end;225begin  ParamTalk=Toy.Talk(BedTimePath+′pp005.wav′,′S′);  Synchronize(UpdateBedTimeRitualBar);  BedTimeRitualNextSection=10;  end;226begin  PeramTalk=Toy.Talk(BedTimePath+′pp005.wav′,′S′);  Synchronize(UpdateBedTimeRitualBar);  BedTimeRitualNextSection=5;  end;230begin  ParamTalk=Toy.Talk(BedTimePath+′pp005.wav′,′S′);  Synchronize(UpdateBedTimeRitualBar);  BedTimeRitualNextSection=-1;  end;235begin  ParamTalk=Toy.Talk(BedTimePath+′pp005.wav′,′S′);  Synchronize(UpdateBedTimeRitualBar);  BedTimeRitualNextSection=10;  end;240begin  ParamTalk=Toy.Talk(BedTimePath+′pp005.wav′,′S′);  Synchronize(UpdateBedTimeRitualBar);  BedTimeRitualNextSection=10;  end;245begin  ParamTalk=Toy.Talk(BedTimePath+′pp005.wav′,′S′);  Synchronize(UpdateBedTimeRitualBar);  BedTimeRitualNextSection=5;  end;250begin  ParamTalk=Toy.Talk(BedTimePath+′pp005.wav′,′S′);  Synchronize(UpdateBedTimeRitualBar);  BedTimeRitualNextSection=-1;  end;255begin  ParamTalk=Toy.Talk(BedTimePath+′pp005.wav′,′S′);  Synchronize(UpdateBedTimeRitualBar);  BedTimeRitualNextSection=10;  end;260begin  ParamTalk=Toy.Talk(BedTimePath+′pp005.wav′,′S′);  Synchronize(UpdateBedTimeRitualBar);  BedTimeRitualNextSection=10;  end;265begin  ParamTalk=Toy.Talk(BedTimePath+′pp005.wav′,′S′);  Synchronize(UpdateBedTimeRitualBar);  BedTimeRitualNextSection=5;  end;270begin  ParamTalk=Toy.Talk(BedTimePath+′pp005.wav′,′S′);  Synchronize(UpdateBedTimeRitualBar);  BedTimeRitualNextSection=-1;  end;275begin  ParamTalk=Toy.Talk(BedTimePath+′pp005.wav′,′S′);  Synchronize(UpdateBedTimeRitualBar);  BedTimeRitualNextSection=10;  end;  {else  begin  Terminate;  Exit;  end;}  end;//--------------endof"BedTimeRitual"sesions--------------  if(IntroNextSection=-1)and  (PlayNextSection=-1)and  (PrincessNextSection=-1)and  (TheStoryMenuNextSection=-1)and  (RunStoryMenuNextSection=-1)and  (BedTimeRitualNextSection=-1)and  (GrouchyNextSection=-1)and  (BunnyNextSection=-1)thenTerminate;  *}  if((ParamTalk=-2)or(ParamListen=-9999))and(PresentationNextSection<>750)then  begin  PrincessNextSection=-1;  PresentationNextSection=750;ParamTalk=0;  ParamListen=0;  ifLastPresentation<1thenLastPresentation=699;  Synchronize(UpdatePresentationBar);  end;  ifPanelControlForm.Status=′STOP′then  begin  PresentationNextSection=6;  Synchronize(ClearStatusControl);  end;  ifPanelControlForm.Status=′START′then  begin  PresentationNextSection=10;  Synchronize(ClearStatusControl);  VisitSongMenu=0;  VisitGameMenu=0;  VisitStoryMenu=0;  VisitBunnyShort=0;  VisitBunnyLong=0;  VisitPrincess=0;  BunnyFavoriteFood=″;  end;  ifPanelControlForm.Status=′PAUSE′then  begin  ifPresentationNextSection=10000then  PresentationNextSection=LastPresentation  else  begin  LastPresentation=PresentationNextSection;  PresentationNextSection=10000;  end;  Synchronize(ClearStatusControl);  Synchronize(UpdatePresentationBar);  end;  end;//EndofTerminate  Terminate;  Exit;end;procedureTIntro.UpdateIntroBar;begin//Introhave450sectionsStatusForm.StatusGauge.Progress=Trunc(IntroNextSection/4.5);StatusForm.Labell.Caption=IntToStr(IntroNextSection);end;procedureTIntro.UpdatePlayBar;begin//Playhave450sectionsStatusForm.StatusGauge.Progress=Trunc(PlayNextSection/4.5);StatusForm.Labell.Caption=IntToStr(PlayNextSection);end;procedureTIntro.UpdatePrincessBar;begin//Princesshave450sectionsStatusForm.StatusGauge.Progress=Trunc(PrincessNextSection/4.5);StatusForm.Labell.Caption=IntToStr(PrincessNextSection);end;procedureTIntro.UpdateTheStoryMenuBar;begin//TheStoryMenuhave450sectionsStatusForm.StatusGauge.Progress=Trunc(TheStoryMenuNextSection/4.5);StatusForm.Labell.Caption=IntToStr(TheStoryMenuNextSection);end;procedureTIntro.UpdateRunStoryMenuBar;begin//RunStoryMenuhave450sectionsStatusForm.StatusGauge.Progress=Trunc(RunStoryMenuNextSection/4.5);StatusForm.Labell.Caption=IntToStr(RunStoryMenuNextSection);end;procedureTIntro.UpdateBedTimeRitualBar;begin//BedTimeRitualhave450sectionsStatusForm.StatusGauge.Progress=Trunc(BedTimeRitualNextSection/4.5);StatusForm.Labell.Caption=IntToStr(BedTimeRitualNextSection);end;procedureTIntro.UpdateGrouchyBar;begin//Grouchyhave450sections  StatusForm.StatusGauge.Progress=Trunc(GrouchyNextSection/4.5);  StatusForm.Label1.Caption=IntToStr(GrouchyNextSection);end;procedureTIntro.UpdateBunnyBar;begin//Bunnyhave450sections  StatusForm.StatusGauge.Progress=Trunc(BunnyNextSection/4.5);  StatusForm.Labell.Caption=IntToStr(BunnyNextSection);end;procedureTIntro.UpdatePresentationBar;begin//Presentationhave5000sections  StatusForm.StatusGauge.Progress=Trunc(PresentationNextSection/50);  StatusForm.Labell.Caption=IntToStr(PresentationNextSection);  StatusForm.StandByLabel.Visible=False;  ifPresentationNextSection=699then  begin  StatusForm.StandByLabel.visible=True;  StatusForm.StandByLabel.Caption=′STANDBYMODE′;  end;  ifPresentationNextSection=750then  begin  StatusForm.StandByLabel.Visible=Tte;  StatusForm.StandByLabel.Caption=′SLEEPMODE′;  end;  ifPresentationNextSection=10000then  begin  StatusForm.StandByLabel.Visible=True;  StatusForm.StandByLabel.Caption=′PAUSE′;  end;end;procedureTIntro.ClearStatusControl;begin  PanelControlForm.Status=″;end;procedureTIntro.ApplicationMinimize;begin  StatusForm.Hide;  StatusForm.WindowState=wsNormal;  StatusForm.Show;  Application.Minimize;end;end.]]></pre>基站源代碼基站源代碼的系列單端口微片;14.04.981800MH_RF.asmUART,14.7456MHZ,F(xiàn)IFO8KBM.Kholod.;MH1.CTP1&amp;org042.VER,CMH3.DelCMH.asm,4.CopyMH->\CMH,;6.RenMH->CMH,7.BCTP1&amp;org4MH->CMH,8.CTP4";CEIBO_config;06.041.MemoryDistribution(PAC||PEDELEHIE);06.042.In"NHfifo8K.asm"BF=42,BYTE=43(before40,41);;COMH/COHMPC-HUBFF05(Type=81Leng=01Data=47)KS=C9(=81+01+47);RFTX/RX55*5Bar=32(Type=D1Leng=02Data=2CA1)KS=A0(=D1+02+2C+A1)LISTp=16c73a__configB′00000000110010′;forCEIBO=Y(jié)6PAT63TYCTPOKY!;|||||||SelectXTOscil=01=04MHZ;====|||||++------>SelectHSOscil=10=10,20MHZ;|14.7MHZ|=′10′||||+-------->W(wǎng)DTDisabled;====|||+--------->Power-upTimerEnabled;|++---------->Codeprotectionoff;yelred+------------>Brown-outResetDisabled;RXTX0;xxxxxxxx==========14.7MHZ<==>0.2712673611U;237|***?3?|Tcomm=1cycl=0.27U;xxxxxxx==========;;BaudRate=115200,8-bit1-StopBit,NoParityRAO;A/DWorks8KHz,8bit;PIC16C73A;;x01RESET()RB728xB7=>COMP_EN;AUD_INA/D=>A0x02RA0/AN0\_/RB627xB6=>RF_EN;TX+B2_IN<=A1x03RA1/AN1RB526xB5;TX_DATA<=A2x04RA2/AN2RB425xB4<=>FIFO;VREF=>A3x05RA3/AN3/REFRB324xB3;CD_N__=>A4x06RA4/TOCKIRB223xB2;OE<=A5x07RA5/AN4/SSRB122xB1=>CLK;Ground=>x08VSSRB0/INT21xB0=>DATA;OSCi14MHZ=>x09OSC1/CLKINVDD20x<=;OSCo__<=x10OSC2/CLKOUTVSS19x<=;WE<=C0x11RC0/T1OSO/T1CKIRC7/RX/DT18xC7<=BASE_RX;BASE_CTS=>C1x12RC1/T1OSI/CCP2RC6/TX/CK17xC6=>BASE_TX;PWM<=C2x13RC2/CCP1RC5/SDO16xC5=>G(CLK);BASE_RTS<=C3x14RC3/SCK/SCLRC4/SDI/SDA15xC4<=RX_DATA-----------------------------------------;PC_01234567PC_;STRB/||||||\ACKPCCONNECTOR;12345678910;xxxxxxxxxxxxxx;;^COMM,PWM^---------;-----------------------|------------>|||;||COMM||-Data-->||||||;|PC|------>|PIC|-Clock->|RF|-+<-----------+--|RF|;-------UART||--EN--->||A/D,STATUS||;||<----|HUB|RC2=PWM|PLL|ACK,SENSOR|PIC|;|Com-port|ACK||------->|(Comp-||TOY|;||STATUS||<-------|ander)|||;-----------SENSOR---------RA0=A/D----------------;;==============================;MFPW||__PWM||||||COMM|HEAD||;||7|6|5|4|3|2|1|0||;==============================;|||;PWM=0->NotRead/1->Read|0-WaitCOh;|1-YesHEADO(CO);|andLeng=CNT;1->YesHead,WaitandReadCommandfromPC---+;;==============================;MFAD||__AD||||APK|ACN|ALH|ATP||;||7|6|5|4|3|2|1|0||;==============================;|||||;_AD=0->A/DNotStarted|||=1->HEADO=FF;|||WaitType;1->YesLSB=LCL->YesACN------+||;|+-=1->YesType;ALH=1->YesMSBLeng=ACNH---------+;#INCLUDE"microch.asm"#DEFINEHUB;ForHUB.HUB=BASE/TOY=HANDSelect;******Constants******;---------------------------------------------M_VEREQU45;8=Y(jié)ear(98),3=Month(March).{HOPOKAMD/2}MSYNCEQU05;Head1=05hSyncPC<-->HUB=FF05...SYNCO1BEQUB′01010101′;SyncFrequenceRFSYNC5LEQU05;5BytesinSyncRFSYNC5REQU05;5BytesSYNCCompareinRXBARKERBEQUB′00110010′BARK_TOEQU(SYNC5L+5)*8;MaxBitsbeeforeBARKER;4MHZ,F(xiàn)[USER]=8KHZ,Presc=14000/(4*8)-1=124?。?!TOY4MHZRF??;14.7456MHZ,F(xiàn)[USER]=8.014KHZ,Presc=4(T2CON,0=1)14745/(4*8*4)-1=114RF_PR2EQUd′114′;andPresc.=4=T2CON,0=1RF?。。?;------PWM|;ifF[osc]=14745.6KHZ,Presc=1,PR2=(14745.6/4*56))-1=64.8=65|;F[user]=F[osc]/((PR2+1)*4*Presc)=14745/(66*4)=55.854(54)KHZ|;PR2=(F[osc]/(4*F[user]*Presc))-1=(14,745/(4*56*1))-1=65|PWM_PR2EQUd′65′;?。。R2>CCPR1L,CCP1CON=8Bit!!11.1|OVERSAMPLINGEQU7;(BOCK.PA3PEREKRYTIE)17.9U*7=125.3U|;F[pwm]=7*8KHZ=56KHZ->F[user]=56KHZ->17.86U=.01786MS->|;ifF[osc]=10.2MHZ,Presc=1,PR2=(10,200/4*40*1))-1=62.8=63|;F[user]=F[osc]/((PR2+1)*4*Presc)=10200/(63*4)=40.5KHZ|;ifF[osc]=4MHZ,Presc=1,PR2=(4,000/4*40*1))-1=24|;ifF[osc]=10MHZ,Presc=1,PR2=(10,000/4*40*1))-1=61.5=62|;F[user]=F[osc]/((PR2+1)*4*Presc)=10000/(63*4)=39.68KHZ|;ifF[osc]=20MHZ,Presc=1,PR2=(20,000/4*40*1))-1=124|;F[user]=F[osc]/((PR2+1)*4*Presc)=20000/(125*4)=40.00KHZ|;--------PWM|RTS_TRISEQUTRISCRTS_PORTEQUPORTCRTS_BITEQU3;RC3CTS_TRISEQUTRISCCTS_PORTEQUPORTCCTS_BITEQU1;CTS=RC1=1=>PCNotReadytoReadCLK_PORTEQUPORTBCLK_TRISEQUTRISBCLKEQU1;RB1DATA_PORTEQUPORTBDATA_TRISEQUTRISBDATABITEQU0;RB0RX_DATA_PEQUPORTCRX_DATA_TEQUTRISCRX_DATAEQU4;RC4TX_DATA_PEQUPORTATX_DATA_TEQUTRISATX_DATAEQU2;RA2ENMC_PORTEQUPORTBENMC_TRISEQUTRISBENMCEQU7;RB7ENPF_PORTEQUPORTBENRF_TRISEQUTRISBENRFEQU6;RB6;-------------------------------------------------------------;******Variables******;-------------------------------------------------------------W_TMPEQU20;TempStorageforW[20]STATUS_TMPEQU21;forSTATUS[21]FSR_TMPEQU22;forFSR[22];PCLATH_TMPEQU23;forPCLATH[23]MFEQU24;CurentProcess,STATE(COCTORHIE)PWMSEQU7;1PC-UART->MBYTE-FIFO->SamplePWM/0COMHCOPWEQU6;1SourceState=PWM,aval(ODHAKO)FF05...??。OHMEQU4;1HUB(HBYTE)->PCACKorSTATUSCOHMRFEQU3;1TOY-HUB->PCACKorSENSOR(STATUS)fromTOYADSMEQU2;1A/DSable-FIFO->HBYTE-UART->PCRFTXEQU0;1RFTX/0RFRXifCOPW=COHM=COHMRF=0NotPWM&amp;COHMFRFEQU25;RFFlags?。oBeginRFFRF(,_BUSY)=00(0)!_BUSYEQU7;1RFBusyProcessRFTXIRXinInterrupt_ERREQU6;1KSError(RX)_CUREQU4;1YesBarker,RX|TXWait|SendCur.DataBits|Bytes_NLENEQU3;1YesLength,RX|TXWait|SendCurr.DataBit|Byte_TYPREQU2;1YesType,RXWaitLength_BAREQU1;1YesSYNC,RX|TXWaitBarker|SendSYNCandBarker_NIBEQU0;1LowNibbleisReceived_MFHEQU26;HUBFlags_CMBEQU7;1YesMBYTEfromPC.HADOEGOO6PA6OTAT6&amp;=0;0HADOReadBytePC->MBYTE&amp;_CMB=0_PWMEQU6;1HADOFIFO-BUFR->W(wǎng)(Sample)&amp;_PWM=0;0WaituntillinInterrupt8KHZ_PWM=1_DATEQU5;1Yesmin(>1KBytes)inFIFO;0FIFOstillempty(<1K)->NotSing_ADEQU4;1HADOA/DSample-BUF_W->FIFO&amp;_AD=0;0WaituntillinInterrupt8KHZ_AD=1_PLAEQU3;1Fluentend(PLABH3ABEPWEHIEDOIC4EPBuff)};0Immedinate(HEMEDLEHHOE)EndPWMorA/D,and=>BUF_SETTSTADEQU2;1TESTHUB->PC00,01,..FE,F(xiàn)E(#FF),00,..TSTPWEQU1;1TESTPC->HUB00,01,..FE,F(xiàn)E(#FF),00,..TSMPLEQU0;1Samlerenewing{O6HOBILOC6}FCOMHEQU28;FlagsforCOMHFCOHMEQU29;FlagsforCOHM_COMEQU7;1ReadCOMHorSendCOHM(TEKBytesCOMM)_LENEQU6;1Read(PC->HUB)orSend(HUB->PC)LengthCOMM_TYPEQU5;1-"-Typep.6=1=TOY/0=HUB;p.5=1=Y(jié)esACK/0=No_SYNEQU4;1Read(PC->HUB)orSend(HUB->PC)Head1=05h_MESEQU1;1YesSpecialHUBMessage(8E)ErrororInformation_2L3EQU0;1LengthCOMH=1,3,..odd(HE4ETH)/0=0,2,..evenMBYTEEQU2A;BytefromPC->HUBHBYTEEQU2B;BytefromHUBtoPC;BMHforCOMH(PC->HUB)2E(MTYPE)2F(MHCNT)30-40(BMH_DATA)+(SCOMH)2C-40SCOMHEQU2C;KSCOMH=Type+Length(=n)+BMHD0+..+BMHDn-1ACOMHEQU2D;AddressCurrentByteBuffBMH(COMH)(PC->HUB)30h-3FhMTYPEEQU2E;TypeCOMHPC->HUBMHCNTEQU2F;CounterCOMHPC->HUB=LengthCOMM<=16=10hACOMH0EQU30;AddressCOMHPC->HUB(Leng<=10h),COMHO=INSTR!PLLADREQUACOMH0;AddressPLLReg.[30]PLLDATHEQUACOMH0+1;Data(MSB)[31]PLLDATLEQUACOMH0+2;Data(LSB)[32]...[3F][40];42BFFW=1,F(xiàn)R=0;0->BUFempty(FR=0)orfull(FR=1);43BYTE;44-45BCM46-47BARH,BARL48-49BAWH,BAWL;BHMforCOHM(HUB->PC)4E(MTYPE)4F(HLENG)50-60(BHM_DATA)+(SCOHM)4C-60SCOHMEQU4B;KSCOHMHUB->PCACOHMEQU4C;AddressCurrentByteBuffBHM(COHM)(HUB->PC)50h-5FhHM_CNTEQU4D;CounterCOHMHUB->PCHTYPEEQU4E;TypeCOHMHUB->PCHLENGEQU4F;LengthCOHMHUB->PCACOHM0EQU50;AddrCOHMHUB->PC,COHM0=Instr.Sens.orACK?。?!PSHADREQUACOHM0;AddressPLLShadowReg.[50]PSHDATHEQUACOHM0+1;Data(MSB)[51]PSHDATLEQUACOHM0+2;Data(LSB)[52]..[5F][60];------PWM|PWM_CntrEQU61;PWMPulseCounterforOversampling[60]|SampleEQU62;CurrentSample[61]|Sample_TMPEQU63;CurrentSampleTmP[62]|;------PWM|MM11PWEQU64MM12ADEQU65MMEQU66MM1EQU67M_CNTEQU68PLLBYTEEQU6A;=>s/rPLLOutPLLCOUNTEQU6B;Counters/rPLLOutPLL_LENGEQU6C;p0001111,p=1=Mc/p=0=Sharp;1111=Leng(1-8)PLLSCNTEQU6D;Counters/rPLLSetupMSTATUSEQU70;ECcccceeee=ExitCode=HUBStatusMCODEEQU71;ECcccceeee=ExitCode=HUBStatus;cccc=7|6|5|4=whereto{KYDA},eeee=ErrorCode;0h=0xxx=>CycleMCOMH->MCOHM->MPWMS->MADSM->MCOMH...;8h=10xx=>MLOOP00=BUF_SET->MCOMH->...(StartPWAorA/D);Ch=110x=>M_START=BreakHUB;Eh=1110=>START=ResetHUB;Fh=1111=>ErrororMessage=>FCOMH=0;MSTATUS=Status=MCODE;;ifCOPW=1,RestoreSoursePWMMode;;eeee=0h=OK.1h=StopD/A,butNotPWM.2h=NotUART.;3h=UARTbusy4h=CTS=1=>PCNotReadytoRead.;5h=Head1#05.7h=KSError.;8h=Y(jié)esFFh.9h=StopPWM,then=>ACKHM90PWMF.;Dh=ErrorFIFOempty.;Eh=ErrorTestPC->HUBFh=Head0#FF.;MFIFO8K->VariableEQU>=40h?。。?!RF_BYTEEQU74;(IfErrorRX->FRF,_ERR=1&amp;RF_BYTE=ErrorCode)RF_CNTEQU75;CounterBitstoTXRFMCNTEQU76;CounterBytestoTXRF_FSREQU77;AddressBUFFtoRX/TXTX_CNTEQU78;CNT1/2BytesMessagetoTX=2*(Leng+3(TYP,LEN,KS))RX_CNTEQU79;CNTBytesMessageTOY-HUB->PC=Leng+3(TYP,LEN,KS)SRF_KSEQU7A;KSRFRXM8CNTEQU7C;125.32552088U,M8CNT=0->Yes1KHZ=1002.6MSTMR_125UEQU7D;125U=17.90364584U*7=125.32552088UTMR_32MSEQU7E;32MS=125.32552088U*256=32083.333345MSTMR_8SECEQU7F;8SEC=32.08333MS*256=8.2133333364SEC;BANK1!?。。?!BANK1?。。。籅MTforPC-UART-HUB-RF->TOYA1(TXTYPE)A2(TXLENG)A3-B3(BMT_DATA+KS)TXTYPEEQUOA1;TypeTXInstr.PC->TOY[A1]TXLENGEQUOA2;Counter(Length)[A2]BMTOEQUOA3;BMT(Instr.PC->TOY)+KS[A3]-[B3]SHARPSHEQUOB4;!!BANK1![B4]-[BD]SHARP_RX16EQUSHARPSH+0;00000HL(D16)MSB[B4]SHARP_RX08EQUSHARPSH+1;(D15)..(D8)[B5]SHARP_RX00EQUSHARPSH+2;(D7)..(D0)LSB[B6]SHARP_TX16EQUSHARPSH+3;00000LH(D16)MSB[B7]SHARP_TX08EQUSHARPSH+4;(D15)..(D8)[B8]SHARP_TX00EQUSHARPSH+5;(D7)..(D0)LSB[B9]SHAPR_REF8EQUSHARPSH+6;00HH(D11)(D10)(D9)(D8),D11=MSBSHARP_REF0EQUSHARPSH+7;(D7)..(D0)LSB[BB]SHARP_OPT8EQUSHARPSH+8;00LL(D11)(D10)(D9)(D8),D11=MSBSHARP_OPT0EQUSHARPSH+9;(D7)..(D0)LSB[BD];BTMforTOY-RF-HUB-UART->PCBE(RXTYPE)BF(RXLENG)C0-D0(BTM_DATA+KS)RXTYPEEQU0BE;TypeRXACKorSensor[BE]RXLENGEQU0BF;Counter(Length)[BF]BTM0EQU0C0;BTM(Instr.SensororACK)+KS[C0]-[D0]PLLSHADEQU0D0;?。ANK1![D0]PLLSH1HEQUPLLSHAD+2;(+2*1)[D2]PLLSH1LEQUPLLSHAD+3;(+2*1+1)[D3]PLLSH2HEQUPLLSHAD+4;(+2*2)PLLSH2LEQUPLLSHAD+5;(+2*2+1)PLLSH3HEQUPLLSHAD+6;(+2*3)PLLSH3LEQUPLLSHAD+7;(+2*3+1)PLLSH4HEQUPLLSHAD+8;00000000;ALC-Enable,Limiter-Enable,Clk-Disable;|||/+----->VolumeControl(MSB);|||\------->ClkOutSelect;||+--------->1-ClkDisable;|+---------->1-LimiterDisable;+------------>1-ALCDisablePLLSH4LEQUPLLSHAD+9;00000000;Mode-Activ,Tx-UnMuted,Rx-Muted,SP-On;/||||+---->1-SpeakerMute;||||+----->1-RxMute;|||+------>1-TxMute;||+------->RxMode\00-Active;|+-------->StendByMode/11-Inactive;+---------->VolumeControl(bit2-LSB)PLLSH5HEQUPLLSHAD+0APLLSHSLEQUPLLSHAD+0BPLLSH6HEQUPLLSHAD+0C;00000000;\_/;+------->VoltageReferenceAdjustPLLSH6LEQUPLLSHAD+0D;00000000;||\___/;||+------->FilterClockCounter;|+----------->1-TxScramblerBypass;+------------>1-RxScramblerBypassPLLSH7HEQUPLLSHAD+0E;(+2*7)[DE]PLLSH7LEQUPLLSHAD+0F;(+2*7+1)[DF];MM1->AddrE0h-EFh,MM->AddrF0h-FFh#IFDEFHUB;HUB=BASERY3GH045(Baseset);***DefaultSHARPSettingsforHUB!??!(ForTOYContraryRX<-->TX);fRX=70504*0.0125+21.7=903.000MHZnRX=70504=011368hSHARP_RX16DFEQU05;00000HLD16(101)SHARP_RX08DFEQU13;D15D14D13D12D11D10D9D8SHARP_RX00DFEQU68;D7D6D5D4D3D2D1D0;fTX=74160*0.0125=927.000MHZnTX=74160=0121B0hSHARP_TX16DFEQU03;00000LHD16(011)SHARP_TX08DFEQU21;D15D14D13D12D11D10D9D8SHARP_TX00DFEQU0B0;D7D6D5D4D3D2D1D0;Reference=3400=0D48hSHARP_REF8DFEQU3D;00HHD11D10D9D8B′0011′DhSHARP_REF0DFEQU48;D7D6D5D4D3D2D1D0;SetingOptionsforNormalOperatingMode=B′0000101000000000′SHARP_OPT8DFEQU0A;00LLD11D10D9D8SHARP_OPT0DFEQU00;D7D6D5D4D3D2D1D0#ELSE;TOY=HANDRY3GH045(Handset);DefaultSHARPSettingsforTOY.(ForHUBContrary,butFormulathesame!);fRX=72424*0.0125+21.7=927.000MHZnRX=72424=011AE8hSHARP_RX16DFEQU05;00000HLD16(101)SHARPRX08DFEQU1A;D15D14D13D12D11D10D9D8SHARP_RX00DFEQU0E8;D7D6D5D4D3D2D1D0;fTX=72240*0.0125=903.000MHZnTX=72240=011A30hSHARPTX16DFEQU03;00000LHD16(011)SHARP_TX08DFEQU1A;D15D14D13D12D11D10D9D8SHARP_TX00DFEQU30;D7D6D5D4D3D2D1D0;Reference=3400=0D48hSHARP_REF8DFEQU3D;00HHD11D10D9D8B′0011′DhSHARP_REF0DFEQU48;D7D6D5D4D3D2D1D0;SetingOptionsforNormalOperatingMode=B′0000101000000000′SHARP_OPT8DFEQU0A;00LLD11D10D9D8SHARPOPT0DFEQU00;D7D6D5D4D3D2D1D0#ENDIF;[A2]-[AB];******DefaultPLLSettings(descriptionseeupword)PLLDR1HEQU00PLLDR1LEQU00PLLDR2HEQU00PLLDR2LEQU00PLLDR3HEQU00PLLDR3LEQU00PLLDR4HEQU18PLLDR4LEQU0C3PLLDR5HEQU3DPLLDR5LEQU0E0PLLDR6HEQU00PLLDR6LEQU0DFPLLDR7HEQU00PLLDR7LEQU00;=========================org0000hgotoSTART;09.04.981800MH_RF.asmUART,14.7456MHZ,F(xiàn)IFO8KBM.Kholodorg0004hGOTOINTHANDLERR;---------------------------------------------------;******ROMConstants******;---------------------------------------------------PLLSetDFclrfPCLATH;Shouldbeinpage0ADDWFPCL,F(xiàn)NOPNOPRETLWPLLDR1HRETLWPLLDR1LRETLWPLLDR2HRETLWPLLDR2LRETLWPLLDR3HRETLWPLLDR3LRETLWPLLDR4HRETLWPLLDR4LRETLWPLLDR5HRETLWPLLDR5LRETLWPLLDR6HRETLWPLLDR6LRETLWPLLDR7HRETLWPLLDR7LEncodeTable;RFMessageEncodingTableclrfPCLATH;Shouldbeinpage0addwfPCL,F(xiàn)retlwB′01001010′;0hretlwB′01010010′;1hretlwB′01011010′;2hretlwB′01101010′;3hretlwB′01001100′;4hretlwB′01010100′;5hretlwB′01100100′;6hretlwB′01101100′;7hretlwB′10010010′;8hretlwB′10011010′;9hretlwB′10101010′;AhretlwB′10110010′;BhretlwB′10010100′;ChretlwB′10100100′;DhretlwB′10101100′;EhretlwB′10110100′;Fh;-----------------------------------------------------DecodeTable;RFMessageDecodingTableclrfPCLATH;Shouldbeinpage0addwfPCL,F(xiàn);InputCorrectedtoretlwB′00001000′;0000000100retlwB′00001100′;0000100101retlwB′00001001′;0001000110retlwB′00001110′;0001101011retlwB′00001000′;00100retlwB′00001100′;00101retlwB′00001001′;00110retlwB′00001001′;0011100110retlwB′00001101′;0100001010retlwB′00001101′;01001retlwB′00001010′;01010retlwB′00001110′;01011retlwB′00001011′;01100retlwB′00001111′;01101retlwB′00001011′;0111001100retlwB′00001111′;0111101101retlwB′00000000′;1000010010retlwB′00000100′;1000110011retlwB′00000000′;10010retlwB′00000100′;10011retlwB′00000001′;10100retlwB′00000101′;10101retlwB′00000010;10110retlwB′00000010;1011110110retlwB′00000110;1100011001retlwB′00000110;11001retlwB′00000011;11010retlwB′00000111;11011retlwB′00000001;1110010100retlwB′00000110′;1110111001retlwB′00000011′;1111011010retlwB′00000111′;1111111011;==============================#INCLUDE"MHfifo8K.asm";FIFOBUF;==============================;SHARPSET-SetSHARPRegisterstodefault;------------------------------------------------------------SHARPSETBSFFCOMH,_2L3;=1->For19BitLength=3MOVLWSHARP_RX16DFMOVWFPLLADRMOVLWSHARP_RX08DFMOVWFPLLDATHMOVLWSHARP_RX00DFMOVWFPLLDATLCALLSHARP_WMOVLWSHARP_TX16DFMOVWFPLLADRMOVLWSHARP_TX08DFMOVWFPLLDATHMOVLWSHARPTX00DFMOVWFPLLDATLCALLSHARPWBCFFCOMH,_2L3;=0->For14BitLength=2MOVLWSHARP_REF8DFMOVWFPLLADRMOVLWSHARP_REF0DFMOVWFPLLDATHCALLSHARP_WMOVLWSHARP_OPT8DFMOVWFPLLADRMOVLWSHARP_OPT0DFMOVWFPLLDATHCALLSHARP_WRETURN;--------------------------------------------------;PLLSetup-SetCompanderRegisterstodefault;--------------------------------------------------PLLSetupCLRFPLLADRMOVLW7MOVWFPLLSCNTPLLSetLINCFPLLADR,F(xiàn);(PLLADR)=Addr=i(i=1,2,..,7)BCFSTATUS,_C;C=0RLFPLLADR,W;*2CALLPLLSetDF;(W)=PLLDRiH,i=1,...,7MOVWFPLLDATHBCFSTATUS,_C;C=0RLFPLLADR,W;*2ADDLW1CALLPLLSetDF;(W)=PLLDRiLMOVWFPLLDATLCALLPLL_W;Write(output)toPLLDECFSZPLLSCNT,F(xiàn)GOTOPLLSetLRETURN;-------------------------------------------------;PLLLiSTenOpen=>SetTx-Mute;Rx-on;Spk-on;(listenopen=>bits100);;PLLListenClose=>SetTx-on;Rx-Mute;Spk-Mute;(listenclose=>bits011);-------------------------------------------------PLLLsitenOpenMOVLW04MOVWFPLLADRMOVLWPLlH4LMOVWFFSR;inBANK1,indirectMOVFINDF,WANDLW0F8;clearlast3bitsTx,Rx,SpkIORLW04;4=100=>Tx-Mute;Rx-on;Spk-onGOTOPLllistenPLLListenCloseMOVLW04MOVWFPLLADRMOVLWPLLSH4LMOVWFFSR;inBANK1,indirectMOVFINDF,WANDLW0F8;clearlast3bitsTx,Rx,SpkIORLW03;3=011=>Tx-on;Rx-Mute;Spk-MutePLLListen;CommonMOVWFPLLDATLMOVLWPLLSH4HMOVWFFSR;inBANK1,indirectMOVFINDF,WMOVWFPLLDATHCALLPLL_WRETURN;------------------------------------------------------;PLL_W-write(output)toPLL(Compander);(PLLADR)=(ACOMH0)=Reg.Number(1..7);(PLLDATH,PLLDATL)=MSB,LSB=(ACOMH0+1,ACOMH0+2);-------------------------------------------------------PLL_WBSFENMC_PORT,ENMC;EN=1BSFPLL_LENG,7;p=1->Leng=8BitsAllByteMOVFPLLADR,WMOVWFFSR;Addr=N.Reg.1..7CALLPLLOut;OutAddr.???If(W)=0or(W)>7????!BCFSTATUS,_C;C=0RLFFSR,W;*2ADDLWPLLSHADMOVWFFSR;AddressPLLSHiHBCFENMC_PORT,ENMC;EN=0MOVFPLLDATH,W;PLLDATHMOVWFINDF;SavePLLDATHtoShadow(indirect)CALLPLLOut;OutputMSB-BytetoPLLMOVFPLLDATL,W;PLLDATLINCFFSR,F(xiàn);AddressPLLSHiLMOVWFINDF;SavePLLDATLtoShadow(indirect)CALLPLLOut;outputLSB-BytetoPLLBSFENMC_PORT,ENMC;EN=1NOP;USNOP;USNOP;USBCFENMC_PORT,ENMC;EN=0RETURN;--------------------------------------------------SHARPW-Write(Output)toPLLSHARP(PLLADR,;PLLDATH,PLLDATL)=(ACOMH0,ACOMH0+1,ACOMH0+2);FCOMH,_2L3=0(Leng=2)->For14bit/=1->For19bit;00MSB=a,b,D16(orD11)..D2,D1,D0=LSB;ab10=RX,01=TX,11=Reference,00=Options;---------------------------------------------------------SHARP_WMOVLW08MOVMFPLL_LENG;8BitsLSB=D0D1..D7SKIP_IF_SETFCOMH,_2L3GOTOSHARPW14;0->Leng=2->For14bit;1->Leng=3->For19bitMOVLWSHARP_RX00;For19bitSKIP_IF_SETPLLADR,2;22ADDLW03;0000001x=00000LHx->SHARP_TX00MOVWFFSRMOVFPLLDATL,W;PLLDATL=ACOMH0+2=D7-D0for19bitGOTOSHARPW2SHARPW14;0->Leng=2->For14bitMOVLWSHARP_REF0;For14bitSKIP_IF_SETPLLADR,5;55ADDLW02;0000xxxx=00LLxxxx->SHARP_OPT0MOVWFFSRMOVFPLLDATH,W;PLLDATH=ACOMH0+1=D7-D0for14bitSHARPW2MOVWFINDF;SaveSHARPLSB-AYTEtoShadow(indirect)CALLPLLOut;OutputLSB-BytetoSHARPD0D1..D7DECFFSR,F(xiàn)MOVLW06;6BitsD8D9D10D11ba-MSBSKIP_IF_SETFCOMH,_2L3GOTOSHARPW4;0->Leng=2->For14bit;Leng=3->For19bitMOVFPLLDATH,W;PLLDATH=ACOMH0+1=D15-D8for19bitMOVWFINDF;SaveSHARPmiddle-BYTEtoShadow(indir.)CALLPLLOut;Outmiddle-BytetoSHARPD8D9..D15DECFFSR,F(xiàn)MOVLW03;3BitsD16ba-MSBSHARPW4MOVWFPLL_LENGMOVFPLLADR,WMOVWFINDF;SaveSHARPMSB-BYTEtoShadow(indirect)CALLPLLOut;OutMSB-BytetoSHARP..D16(D11)baBSFENRF_PORT,ENRF;EN=1NOP;USNOP;USNOP;USNOP;>1.0U5*Tcomm=5cycl=1.35UBCFENRF_PORT,ENRF;EN=0RETURN;------------------------------------------------------------;PLLOut-OutPLL_LENG(8..)Bits(W)toPLL(Compander);PLL_LENG=p0001111,1111=Leng(1,2,..,8),;p=1=Mc=MSB--LSB/p=0=SHARP=LSB-MSB;------------------------------------------------------------PLLOutMOVWFPLLBYTEMOVLW08SKIP_IF_SETPLL_LENG,7MOVFPLL_LENG,W;p=0->SHARP->W(wǎng)=Leng<=8MOVWFPLLCOUNTPLLOutL;loopSKIP_IF_NOTPLL_LENG,7;2cyclGOTOPLLOutMc;p=0->SHARP->LSB--MSBMOVLW0FC;-4;1cyclPLLOutSHADDLW01;1cyclSKIP_IF_Z;5=3+2GOTOPLLOutSH;6=3*2RRFPLLBYTE,F(xiàn);C=LSB;1cyclGOTOPLLOutSHARP;2cycl;tCKR=RateofCLK=18+3(cycles)>5UPLLOutMcRLFPLLBYTE,F(xiàn);C=MSBPLLOutSHARPSKIP_IF_NCGOTOPLLOut1;C=1BCFDATA_PORT,DATABIT;DATA=C=0GOTOPLLOutCPLLOut1BSFDATA_PORT,DATABIT;DATA=C=1PLLOutCNOP;>0.1UTcomm=1cycl=0.27UBSFCLK_PORT,CLK;CLK=1NOP;USNOP;USNOP;USNOP;>1.0U5*Tcomm=5cycl=1.35UBCFCLX_PORT,CLK;CLK=0RB1NOP;US;>=5U?????????。。。。。。。。。。?;USNOP;USDECFSZPLLCOUNT,F(xiàn)GOTOPLLOutL;loopRETURN;-----------------------------------------------------------------;PLL_R-ReadBytes(MSB,LSB)fromShadowMemoryto;(PSHDATH,PSHdaTL)=MSB,LSB=(ACOHM0+1,ACOHM0+2);(PSHADR)=(ACOHM0)=(PLLADR)=(ACOMH0)=N.Reg.;-----------------------------------------------------------------PLL_RMOVFPLLADR,WMOVWFPSHADRMOVWFFSR;addressBCFSTATUS,_C;C=0RLFFSR,W;*2ADDLWPLLSHADMOVWFFSR;addressPLLSHiHMOVFINDF,W;Restore(MSB)fromShadow(indirect)MOVWFPSHDATH;toPSHDATHINCFFSR,F(xiàn);addressPLLSHiLMOVFINDF,W;Restore(LSB)fromShadow(indirect)MOVWFPSHDATL;toPSHDATLRETURN;----------------------------------------------------------------------------;SHARP_R-ReadBytes(3-for19bitor2-for14bit)fromShadow;Memoryto(PSHADR,PSHDATH,PSHDATL)=(ACOHM0,ACOHM0+1,ACOHM0+2);(PLADR)=xxxxxxcd00=RX,01=TX,10=Reference,11=ptions;----------------------------------------------------------------------------SHARP_RSKIP_IF_NOTPLLADR,1;c=?GOTOSHARPR14;1x->for14bitREFerenceorOPTions;0x->for19bit(3Bytes)RXorTXMOVLWSHARP_RX16;00->RXSKIP_IF_NOTPLLADR,0;d=?MOVLWSHARP_TX16;01->TXMOVWFFSRMOVLW03GOTOSHARPR2SHARPR14;1x->Leng=2(For14bit)MOVLWSHARP_REF8;10->OPTionsSKIP_IF_NOTPLADR,0;d=?MOVLWSHARP_OPT8;11->REFerenceMOVWFFSRMOVLW02SHARPR2MOVWFHLENGMOVFINDF,W;Restore(MSB)fromShadow(indirect)MOVWFPSHADRINCFFSR,F(xiàn)MOVFINDF,WMOVWFPSHDATHINCFFSR,F(xiàn)MOFINDF,WMOVWFPSHDATLRETURN;---------------------------------------------------------;MZP/MZP0-Move(W)/00toAddr=(FSR)Length=(M_CNT)MZP0CLRWMZPMOVWFINDFINCFFSR,F(xiàn)DECFSZM_CNT,F(xiàn)GOTOMZPRETURN;=================================;******StartofProgram******;----------------------------------------------------START;RAM20-RAM7F,RAMA0-RAMFF=00hCLRFFSRBSFFSR,5;FSR=20hMZP00_LSKIP_IF_NOTFSR,7BSFFSR,5;FSR=80h->FSR=A0hCLRFINDFINCFSZFSR,F(xiàn)GOTOMZP00_L;PowerOnSettings;InitializeA/DSELECT_BANK_1;?。ank1?。?!movlw0x05movwfADCON1;SelectRA0,RA1-AnalogInput,vref=RA3SELECTBANK0;??!Bank0!?。ovlwB′10000001′movwfADCON0;SelectFosc/32,Channel0-RA0,A/D-OnInitializeUSARTSELECT_BANK1;??!Bank1!?。ovlw0x01;SetBaudRatefor115.200KHZ=movwfSPBRG;=14745.6KHZ/(64*(SPBRG+1))bcfTXSTA,_SYNC;SetAsynchronoysModebcfTXSTA,_BRGH;SetLowSpeedBaudRateSELECT_BANK_0;?。ank0?。?!bsfRCSTA,_CREN;EnableRXbsfRCSTA,_SPEN;EnableSerialPortSELECT_BANK_1;!!Bank1!??!bsfTXSTA,_TXEN;bcfTRISC,_TX;SetRFfrequency8.014KHZandPresc.=4=T2CON,0=1RF?。。ELECT_BANK_1;??!Bank1!?。ovlwRF_PR2;(RF);14745.6/(4*8kHz)-1=115.2-1=114;SetPWMfrequency8*7=56KHZ;SetTimer2for8kHzfrequency;US(PWM)movlwPWM_PR2;14745.6/(4*8kHz*7)-1=64.8=65movwfPR2;??!Bank1!??!SELECT_BANK_0;!!Bank0!??!movlw01;(RF);SetPrescaler(Postscaler=1)to41=4;US(PWM)movlw00;SetPrescaler&amp;Postacalerto1movwfT2CONmovlwOVERSAMPLINGmovwfPWM_Cntr;SetupPWMPulseCounterclrfSample;SetupSampleIndex;SetPWMDutyCycleCLRFCCPR1L;EnableTimer2InterruptBCFPIR1,_MR2IF;ClearIntFlagSELECT_BANK_1;!!Bank1!??!bsfPIE1,_TMR2IE;EnableTMR2=PR2IntbsfINTCON,_PEIE;EnablePeripheralIntbsfINTCON,_GIE;GlobalIntEnable;SetCTS,RX_DATAtoinputandPWMPin,TXDATAtoOutput!!Bank1?。SFCTS_TRIS,CTS_BIT;=1->CTS=RC1toInputBSFRX_DATA_P,RX_DATA;=1->RC4toInputBCFTRISC,2;=0->PWM=RC2toOutputBCFTX_DATA_P,TX_DATA;=0->RA2toOutput;CCP1CON,3=1->PWM-ModeCCP1CON<30>=11xx/=0->NotPWM;ADCON0,_ADON=1->YesA/D=A/DOn,=0->NotA/D;======================================SELECT_BANK_0;!!Bank0!?。ALLPLLSetup;SetCompanderRegisterstodefaultNOP;USCALLSHARPSET;SetSHARPRegisterstodefaultMOVLW81;RESET_ACKGOTOM_START2M_START;<===BreakHUBSELECT_BANK_0;??!Bank0?。?!MOVLW82M_START2MOVWFHTYPE;ACKRESET(81)orBREAK(82)CLRFHLENGCLRFMF;0->waitCOMHPC->HUBBSFMF,COHM;YesCORMHUB->PCBCFCCP1CON,3;DisablePWMBCFADCON0,_ADON;DisableA/D,SwitchOffCLRFMFHCLRFFCOMHCLRFFCOHMCLRFMCODECLRFMSTATUSMLOOP00;StartPWMorA/D->BUF_SETCLRFFRF;RFalloveragainCALLBUFF_SET;ResetFIFO(RTS_BIT=0-Rec.fromPC)NOP;US;EnableTimer2;!!Bank0!!!BSFT2CON,_TMR2ON;EnableTimer2MLOOPSKIP_IF_SETRCSTA,_OERR;OverrunErrorBitGOTOMLCOMH;0->NotErrorUART;ErrorUSARTOverrunErrorBit=1(RCSTA=18h=92h)BCFRCSTA,_CREN;ReceiveEnableBit=0->EnableChangeBCFRCSTA,_OERR;OverrunErrorBit=0->NoErrorBSFRCSTA,_CREN;RestoreBit=1MLCOMHSKIP_IF_NOTMF,PWMSGOTOMLPWMS;1->PWMModeNOP;USCALLMCOMH;0->COMMPC->HUBMOVWFMCODESKIP_IF_SETMCODE,7GOTOMLCOHM;0Xh=>CycleMCOMH->MCOHM->RF->SKIP_IF_SETMCODE,6GOTOMLOOP00;8Xh=>StartPWM(A/D)andStopA/D(PWM)SKIP_IF_SETMCODE,5GOTOM_START;CXh=>BreakHUBSKIP_IF_SETMCODE,4GOTOSTART;EXh=>ResetHUBCLRFFCOMH;FXhErrorCOMMFCOMH=00hMOVFMCODE,WMOVWFMSTATUSSKIP_IF_NOTMF,COPWBSFMF,PWMS;FXh&amp;COPW=1RestorePWMModePWMS=1GCTOMLCOHM;CycleMCOMH->MCOHM->RF->MLPWMSNOP;USCALLMPWMSNOP;USMOVWFMCODEGOTOMLCOHM;CycleMPWMS->MCOHM->...MLCOHMSKIP_IF_SETMF,COHMGOTOMLCOHMRF;COHM=0->TestCOHMRFNOP;USCALLMCOHMNOP;USMOVWFMCODEGOTOMLOOP;CycleMCOHM->MCOMHMLCOHMRFSKIP_IF_SETMF,COHMRFGOTOMLADSM;COHMRF=0->NotCOHM,TestA/DNOP;USCALLMCOHM;ForCOHMRFNOP;USMOVWFMCODEGOTOMLOOP;CycleMCOHM->MCOMHMLADSMSKIP_IF_SETMF,ADSMGOTOML_RF;CycleMCOMH->(MADSM)->RF->...NOP;USCALLMADSMNOP;USMOVWFMCODEML_RF;CycleMCOMH->(MADSM)->RF->...SKIP_IF_NOTMF,COPWGOTOMLOOP;COPW=1YesPWM(Notyet[odlo]EndPWM)SKIP_IF_NOTFRF,_BUSYGOTOMLOOP;=1->RF-BusySKIP_IF_NOTMF,COHM;{HEHADO??}GOTOMLOOP;YesCOHMNotRF??TX/RX??{HEHADO?}SKIPIFNOTMF,COHMRFGOTOMLOOP;CORMRF=1->YesCOHMNotRF??TX/RX??SKIP_IFSETMF,RFTXGOTOMLRFRX;RXPWMS=COPW=RFTX=COHM=0RFRXMessage;TXPWMS=COPW=0,RFTX=1Transmit=SendMessageNOP;USCALLMRFTX;PrepareRFTX,StartTX,TransmitinInter.NOP;USMOVWFMCODEGOTOMLOOP;CycleMCOMH->(MADSM)->RF->MCOMH...MLRFRXNOP;USCALLMRFRX;RXPWMS=COPW=RFTX=COHM=0RFRXMessageNOP;USMOOFMCODEGOTOMLOOP;CycleMCOMH->(MADSM)->RF->MCOMH...MRS;RFTX=1Transmit=SendMessage->PrepareRFTXCLRFM8CNTINCFM8CNT,F(xiàn)CLRFFRFMOVLWSYNC5L;PrepareSendSYNC5*8bit(01010101)toTXMOVWFRFMCNT;5*SYNCBytesMOVLWSYNC01BMOVWFRF_BYTE;SYNCByte01010101MOVLW08MOVWFRFCNT;8BitsMOVLWTXTYPEMOVWFRFFSR;AddrBUFTX=A1hBSFFRF,_BUSY;ReadytoRFTXRETLW00MRFRX;RFTX=0ReceiveRFAllMessageNOP;USCLRFM8CNTINCFM8CNT,F(xiàn)CLRFFRFMOVLWRXTYPEMOVWFFSR;AddrBUFRX=C0h(BE,BF,C0,..,CF)CLRFM_CNTBSFM_CNT,3;=8CALLMZP0;MZP/MZP0-Move(W)/00toAddr=(FSR)Leng=(M_CNT)NOP;USCLRFRFCNTBSFFRF,_BUSY;RFB0-RFB7,RF_CNT,..readytoRFRXRETLW00MCOMH;PC-UARTR->HUB(MBYTE)SKIP_IF_NOTMFH,_CMBGOTOMCMH;1YesByte,->Processing(HADOEGOO6PA6OTAT6}MCMHR;_CMB=0ReadBytefromUART(PC->HUB)SKIP_IF_SETPIR1,_RCIFRETLW02;RCIF=0->NotUARTBytefromPC;USCALLIMPULS;TESTIMPULS|_|-BPEMEHHO;YesUARTBytefromPCtoHUB(->W(wǎng))MOVFRCREG,WMOVWFMBYTEMCMH;Processing(O6PA6OTKA)MBYTEfromPCBCFMFH,CMB;CMB=0ByteolredyProcessingMOVFMBYTE,WSKIP_IF_NOTFCOMH,_COMGOTOMCMHCOMSKIP_IF_NOTFCOMH,_LENGOTOMCMHLENSKIP_IF_NOTFCOMH,_TYPGOTOMCMHTYPSKIP_IF_NOTFCOMH,_SYNGOTOMCMHSYNBSFFCOMH,_SYNSKIP_IF_WNEQULOFF;0-Byte=HEDAD0=FFh?RETLW00;Yes->MCOMH->MCOHM->MPWMS->...RETLWOFF;Error(Head0#FFh)->CleanFCOMHMCMHSYN;Sync-Byte=05BSFFCOMH,_TYPSKIP_IF_WNEQULMSYNCRETLW00;=05h->MCOMH->MCOHM->MPWMS->MADSM->MCOMH..RETLW0F5;Error(Head1#05h)->CleanFCOMHMCMHYP;Typep.6=1=TOY/0=HUB;p.5=1=Y(jié)esACK/0=NoBSFFCOMH,_LENMOVWFMTYPEMOVWFSCOMHRETLW00;MCOMH->MCOHM->MPWMS->MADSM->MCOMH..MCMHLENBSFFCOMH,_COMADDWFSCOMH,F(xiàn);KSMOVWFMHCNTMOVLWACOMH0SKIPIFSETMTYPE,6GOTOMCMHLEN2;=0PC->HUBCOMH;=1PC-HUB-RF_TX->TOYCOMRFTXSKIP_IF_NOTMF,RFTXCLRFFRF;1RFTX->StopTXBCFMF,RFIX;alwaystoRFRXMOVLWRXTYPEMOVWFFSRMOVFMTYPE,WMOVWFINDFINCFFSR,F(xiàn)MOVFMHCNT,WMOVWFINDFADDWFMHCNT,W;(W)=2*(MHCNT)ADDLW06;2*3(TYPE+LENG+KS)->MOVWFTX_CNT;ForRFTX(TX_CNT)=2*(Length+3)MOVLWBMT0MCMHLEN2MOVWFACOMH;=ACOMH0(BMH0)orBMT0(BUFFRFTX)BCFFCOMH,_2L3;Length=0,2...even(4ETH)SKIP_IF_NOTMHCNT,0BSFFCOMH,_2L3;=1->Length=1,3,...odd{HE4ETH}INCFMHCNT,F(xiàn);CNT=LengCOMM+1(KS)RETLW00;MCOMH-&gt;MCOHM-&gt;MPWMS-&gt;MADSM-&gt;MCOMH...MCMHCOMMOVFACOMH,WINCFACOMH,F(xiàn)MOVWFFSRMOVFMBYTE,WMOVWFINDFADDWFSCOMH,F(xiàn);KSDECFSZMHCNT,F(xiàn)RETLW00;Current{TEK}ByteCOMH->MCOMH->(MADSM)->MCOMH;EndCOMM(W)=KSR,SCOMH=KS+KSR(=2*KS?)ADDWFINDF,W;(W)=KSR+KSRSKIP_IF_WEQUSCMHRETLW0F7;2*KSR#KS+KSR->KS#KSR->Error;KS=KSR->OKPreparetoRFTX->TOYandtoReadCOMMagain{CHOBA}CLRFFCOMH;PreparetoReadCOMMagain{CHOBA}SKIP_IF_NOTMF,COPWBSFMF,PWMS;COPW=1PWMNotend=>ContinuePWMSKIP_IF_SETMTYPE,6GOTOMCOMHAN;0PC->HUBCOMH->AnalizMTYPE,COMHBSFMF,RFTX;1PC-HUB-RFTX->TOYRFTXRETLW00;->MRFTX->MCOHM->(MADSM)->MCOMHMCOMHAN;COMHendANALIZMTYPE&amp;COMHandPROCESSING{O6PA6OTKA}COMHSKIP_IF_NEQULMTYPE,00GOTOMH00PWM;PC->FIFO(1K)andEnablePWM?。?!SKIP_IF_NEQULMTYPE,01GOTOMH01PLP;FluentEndPWM{PLABH3ABEPWEHIEDOIC4EPBUF}SKIP_IF_NEQULMTYPE,02GOTOMH02ATD;EnableA/DHUB->PCSKIP_IF_NEQULMTYPE,11;USx2{BPEMEHHO}GOTOMH11TSTPW;PC->HUB(PWM)0001..FEFE(#FF)00SKIP_IF_NEQULMTYPE,12;USx2{BPEMEHHO}GOTOMH12TSTAD;HUB->PC(A/D)0001..FEFE(#FF)00SKIP_IF_NEQULMTYPE,20GOTOMH20VER;HUBGetVersionSKIP_IF_NEQULMTYPE,21RETLW0E0;HUBReset=>STARTSKIP_IF_NEQULMTYPE,22RETLW0C0;HUBBreakStopPWMandA/D=>M_STARTSKIP_IF_NEQULMTYPE,23GOTOMH23WMC;WritetoPLL(CompanderMotorola)SKIP_IF_NEQULMTYPE,24GOTOMH24RMC;ReadfromShadowMemory(Comp.Motorola)SKIP_IF_NEQULMTYPE,25GOTOMH25WSH;WritetoSHARPSKIP_IF_NEQULMTYPE,26GOTOMH26RSH;ReadfromShadowMemorySHARPSKIP_IF_NEQULMTYPE,2EGOTOMH2EMES;HUBGetStatusMH00PWM;PC->FIFO((3APOLHEHIEFIFOHA)1K)andEnablePWMBCFADCON0,__ADON;A/DOffBCFMF,ADSM;DisableA/DBSFMF,COPWBSFMF,PWMSRETLW80;=>MLOOP00->BUFSET->MPWMS->MCOMH..MHO1PLP;FluentEndPWM{PLABH3ABEPWEHIEDOIC4EPBuff}}SKIP_IF_SETMF,COPWRETLW01;COPW=0=NotSourcePWMIgnoreC0MMBSFMFH,PLA;PWM-NotFinish.MF,PWMS=1already??!RETLW00;MCOMH->MPWMS->MCOHM->(MADSM)->MPWMS.MH02ATD;EnableA/DHUB->PC(andDisablePWM)BCFMF,PWMSBCFMF,COPWBSFADCON0,_ADONA/DSwitchOnBSFMF,ADSMRETLW80;=>MLOOP00->BUFSET->MCOMH->MCOHM|MADSM->MCOMH..MH11TSTPW;TESTPC->HUB(PWM)0001..FEFE(#FF)0001..CLRFMMCLRFMM1CLRFMM11PWBSFMFH,TSTPWBSFMF,COPWBSFMF,PWMSRETLW00;MCOMH->MCOHM->MPWMS->(MADSM)->MPWMSMH12TSTAD;TESTHUB->PC(A/D)0001..FEFE(#FF)0001..CLRFMM12ADBSFMFH,TSTADBSFADCON0,ADON;A/DSwitchOnBSFMF,ADSMRETLW00;MCOMH->MCOHM|MADSM->MCOMH..MH20VER;HUBGetVersionMOVLW80MOVWFHTYPEMOVLW01MOVWFHLENGMOVLWM_VERMOVWFACOHM0;838=Y(jié)ear(98),3=Month(March)BSFMF,COHMBCFFCOHM,_MES;NotMessageRETLW00;MCOMH-&gt;mCOHM->MCOMH...MH23WMC;WritetoPLL(CompanderMotorola).Addr,MSB-Byte,LSBCALLPLL_WMOVLW83GOTOMH24RMC2MH24RMC;ReadfromShadowMemory(CompanderMotorola)MOVLW84MH24RMC2MOVWFHTYPEMOVLW03MOVWFHLENGCALLPLL_R;(ACOHM0)=(ACMH0),RestoreMLB,LSBBSFMF,COHMBCFFCOHM,_MES;NotMessageRETLW00;MCOMH->MCOHM->MCOMH...MH25WSH;WritetoSHARPCALLSHARP_WMOVLW85MHTOMH26RSH2MH26RSH;ReadfromShadowMerrySHARPMOVLW86MH26RSH2MOVWFHTYPECALLSHARP_RBSFMF,COHMBCFFCOHM,_MES;NotMessageRETLW00;MCOMH->MCOHM->MCOMH...MH2EMES;HUBGetStatusBSFMF,COHMBSFFCOHM,_MES;MessageStatusRETLW00;MCOMH->MCOHM->MCOMH...MCOHM;HUB(HBYTE)-UARTW->PCSKIP_IF_NOTCTS_TRIS,CTS_BIT;CTS=RC1RETLW04;CTS=1=>PCNotReadytoRead;CheckUSARTBusySELECT_BANK_1;!!Bank1!?。KIP_IF_NOTTXSTA,_TRMTGOTOMCHM;=1itispossibleSendHUB->PCSELECT_BANK_0;?。ank0?。。otDelete?。?!RETLW03;USARTbusyMCOHM->MCOMH(MPWMS)...MCHM;Ptepare(PODGOTOBKA)HBYTEtoSendHUB->PCSELECT_BANK_0;!!Bank0?。。otDelete?。?!SKIP_IF_NOTFCOHM,_COMGOTOMCHMCOMSKIP_IF_NOTFCOHM,_TYPGOTOMCHMTYPSKIP_IF_NOTFCOHM,_SYNGOTOMCHMSYNBSFFCOHM,_SYNMOVLWOFF;0-BytePacket=HEAD0=FFhGOTOMCOHMSENDMCHMSYN;Sync-Byte=05BSFFCOHM,_TYPMOVLWMSYNCGOTOMCOHMSENDMCHMTYPBSFFCOHM,_LENSKIP_IF_SETFCOHM,_MESGOTCMCHMYP2;MES=0=>NotSpecialHUBMessage;YesSpecialHUBMessage(ErrororInformation)BCFFCOHM,_MESMOVLW8EMOVWFHTYPEMOVLW04MOVWFHLENGMOVLWM_VERMOVWFACOHM0;838=Y(jié)ear(98),3=Month(March)MOVFMSTATUS,WMOVWFACOHM0+1;seeSTATUS,MCODE=HUBStatusMOVFBCM,WMOVWFACOHM0+2MOVFBCM+1,WMOVWFACOHM0+3;BCM=(BCM=BCH,BCM+1=BCL)-freespaceMCHNTYP2BSFFCOHM,_COMCRLFSCOHMMOWHLENG,W;W=LengthCOHM(SENSORorACK)toPCADDLW03MOVWFHM_CNT;CNT=n+3=Length+3(Type,Length,KS)MOVLWHTYPESKIP_IF_NOTMF,COHMGOTOMCHM2;COHM=1YesCOHM,NotCOHMRF!BCFMF,COHMRF;COHM=0->NotCOHM,YesCOHMRFBSFMF,COHM;ChangCOHMRF<-->COHMMOVFRX_CNT,W;W=LengthCOiF(SENSORorACK)MOVWFHM_CNT;CNT=n+3=Length+3(Type,Length,KS)MOVLWRXTYPEMCHM2MOVWFACOHMMCHMCOMDECFSZHM_CNT,F(xiàn)GOTOMCHMCOM2;ENDCOHMSENSOR(ACK)alreadySenttoPCSendKS,COHM=0,F(xiàn)COHM=0BCFMF,COHMCLRFFCOHMMOVFSCOHM,WMOVWFTXREG;SendKStoPC,andthenRETLW00;MCOHM->MCOMH..MCHMCOW2;SendCurrent(TEK)ByteCOHMtoPCMOVFACOHM,WINCFACOHM,F(xiàn)MOVWFFSRMOVFINDF,WADDWFSCOHM,F(xiàn);KS;(HEHADO?)GOTOMCOHMSENDNOPMCOHMSEND;SendBytetoUSARTMOVWFTXREGRETLW00;MCOHM->MCOMH...;/MPWMS;PC-UART->MBYTE-FIFO->SamplePWM====-SKI_IF_SETMFH,_PWM;\GOTOMPWM;_PWM=0=>SampleodloSing,inInt(8KHZ)=1SKIP_IF_SETMFH,_DAT;{BCEEWEPO4TI}GOTOMPWM;DAT=0->FIFOstillalmostempty<1K;PrepareNextSampletoPlayCLRWCALLBUF_RSKIP_IF_CGOTOMPWSAMPL;C=0->FIFONotempty->OKSKIP_IF_SETMFH,PLAGOTOMPWM;FIFOempty&amp;NotPLAend;C=1&amp;PLA=1FIFOempty&amp;PLAendStopPWM,COHM(ACK)toPCandWaitCOMMBCFMFH,PLABCFMFH,_DAT;FIFOempty->especially{TEM6OLEE}<1KBCFCCP1CON,3;0->NotPWM;SetRFfrequency8.014KHZandPresc.=4=T2CON,0=1RF?。。ELECT_BANK1;??!Bank1?。?!movlwRFPR;(RF);14745.6/(4*8kHz)-1=115.2-1=114movwfPR2;!!Bank1!??!SELECT_BANK_0;?。ank0?。?!BSFT2CON,0;(RF);SetPrescaler(Postscaler=1)to41=4BCFMF,PWMSBCFMF,COPWBSFMF,COHMCLRFHLENGMOVLW90;StatusFinishPWM(COHMHM0PWMF)MOVWFHTYPERETLW09;StopPWMand=>COHM=>HM90PWMFMPWSAMPL;C=0->FIFONotempty->OKMOVWFSample;SetnextPWMSampleBCFMFH,_PWM;__PWM=0->PrepareNotReadBSFMFH,TSMPL;1Samplerenewed{O6HOBILOC6}SKIP_IF_NOTMM1,3GOTOMPWMRLFMM1,WANDLWOEADDLWOF0MOVWFFSRMOVFSample,WMOVWFINDFINCFMM1,F(xiàn)INCFFSR,F(xiàn)DECFBARL,WMOVWFINDFMPWM;ReadPacketDataPC-UART->HUB->FIFO8KSKIP_IF_SETPIR1,_RCIFRETLW02;RCIF=0->NotUARTBytefromPC;USCALLIMPULS;TESTIMPULS|_|-BPEMEHHO;YesUARTBytefromPCtoHUB(->W(wǎng))MOVFRCREG,WMOVWFMBYTESKIP_IF_WEQULOFFGOTOMPWM2;MBYTE#FFh->NotCOMM(AudioPWM)BSFMF,COPW;US?;MBYTE=FFh->batSourceState=PWM->BCFMF,PWMS;->maybe{HABEPHO}yesCOMH->EndPWMBSFMFH,_MB;andmaybeStartCOMMHead0=FFhRETLW08;YesFFhMPWMS->COHM->(MADSM)->MCOMH..MPWM2;Audio,PWM(NoCOMM)MOVFMBYTE,WCALLBUF_WNOP;USSKIP_IF_NOTMM,3GOTOMPWMTSTRLFMM,WANDLWOEADDLWOE0MOVWFFSRMOVFMBYTE,WMOVWFINDFINCFMM,F(xiàn)INCFFSR,F(xiàn)DECFBAWL,WMOVWFINDFMPWM_TSTSKIP_IF_NOTMFH,_DATRETLW00;1YesData-mininFIFOforPWM-OutBCM<1C00;StartandBeginningReadDatafromPC(HUB)toFIFOuntilBCM>=1C00hSKIPIFM_LELMBCM,1C,00;Skipif(BCM,BCM+1)<1C00h=7168RETLW00;MCOMH->MCOHM->MPWMS->MADSM->MCOHM...BSFMFH,_DAT;BCM<1C00->Yes400hBytesinFIFO(>1000);EnablePWM;SetPWMfrequency8*7=56KHZ;SetTimer2for8kHzfrequencySELECT_BANK_1;!!Bank1?。。ovlwPWM_PR2;14745.6/(4*8kHz*7)-1=64.8=65movwfPR2;!!Bank1!??!SELECT_BANK_0;??!Bank0!??!BCFT2CON,0;SetPrescaler&amp;Postscalerto1movlwOVERSAMPLINGmovwfPWM_Cntr;SetupPWMPulseCounterMOVLWOF;PWM-ModeCCP1CON<30>=11xxMOVWFCCP1CONRETLW00;MPWMS->MCOHM->(MADSM)->MCOMH...MADSM;-=A/D-FIFO->HBYTE-UART->PCSKIP_IF_SETMFH,_ADGOTOMAD;A/DNotStarted;USSKIP_IF_SETADCON0,_ADON;USGOTOMAD;ADCON0,ADON=0->NotA/D;US;ADCONO,_ADON=1->YesA/D=A/DOnSKIP_IF_NOTADCONO,_GOGOTOMAD;_GO=1->A/DBusy;_GO=0->A/DCompleteReadA/DResetandStoretoFIFOMOVFADRES,W;ADRES=1EH=A/DResultRegisterSKIP_IF_SETMFH,TSTADGOTOMADSM2;0=NoTestA/D0001..FEFE..;TestHUB->PCA/D0001..FEFE(#FF)00..MOVFMM12AD,WINCFMM12AD,F(xiàn)MADSM2CALLBUF_WBCFMFH,_AD;SetA/DNotStartedFlagMAD;SendSamplesfromFIFOtoUSART->PCSKIP_IF_NOTCTS_TRIS,CTS_BIT;CTS=RC1RETLW04;CTS=1=>PCNotReadytoRead;CheckUSARTBusySELECT_BANK_1;?。ank1?。?!SKIP_IF_NOTTXSTA,_TRMTGOTOMAD2;=1itispossibleSendHUB->PCSELECTBANK0;??!Bank0?。?!NotDelete?。?!RETLW03;USARTbusyMADSM->MCOMH->MPWMS...MAD2SELECT_BANK_0;??!Bank0?。?!NotDelete?。?!CALLBUF_RSKIP_IF_NCRETLWOD;C=1->BUFempty->CycleMOVWFHBYTESKIP_IF_WNEQULOFFDECFHBYTE,F(xiàn);(HBYTE)=FFh->ChangeFFh->FEhMOVFHBYTE,WMOVWFTXREG;HBYTE-UART->PC;USCALLIMPULS;TESTIMPULS|_|-RETLW00;MADSM->MCOMH->(MPWMS)->;{{TESTTMPULSUM;BPEMEHHOIMPULS;TESTIMPULS|_|-BPEMEHHOBTFSCPORTA,2;TestIMPULSPin->XOR0<=>1BPEMEHHOGOTOIMPULS1;BPEMEHHOBSFPORTA,2;0->1;BPEMEHHOGOTOIMPULSEND;BPEMEHHOIMPULS1;BPEMEHHOBCFPORTA,2;1->0;BPEMEHHOIMPULSEND;BPEMEHHORETURN;BPEMEHHO;TESTIMPULS};UM;BPEMEHHOUM)};-------------------------------------------------------;******InterruptHandler******BANK0?。。。?------------------------------------------------------INT_HANDLERRINT_STORE;MOVFPCLATH,W;MOVWFPCLATH_TMP;StorePCLATHtoPCLATH_TMPinBank0;CLRFPCLATH;PageZero,regardlessofcurrentpage;=>BANK0?。。。。?!SKIP_IF_SETPIR1,_TMR2IF;ifTMR2Interrupt?GOTOIRET;_TMR2IF=0->NoTMR2;TMR2IF=1->YesTMR2Interrupt!!Bank0?。。。籔rocessTimer2Int->TestandSetPWMTMR2_INTBCFPIR1,_TMR2IF;ClearIntFlagSKIP_IF_NOTT2CON,0;!!if1->Presc=4->Not56KHZGOTOTMR2_8KHZ;1->RF(NotPWM)->8KHZ(Not56KHZ)DECFSZPWM_Cntr,F(xiàn)GOTOIRET;PWM_Cntr#0movlwOVERSAMPLING;=7->8KHZ*7=56KHZmovwfPWM_Cntr;ResetPWMPulseCounterTMR2_8KHZINCFSZTMR_125U,F(xiàn);125U=17.90364S84U*7=125.32552088UGOTOTMR_TTME;Time=(TMR_125U)*125.32S5UINCFSZTMR_32MS,F(xiàn);32MS=125.32552088U*256=32.083333345MSGOTOTMR_TIME;Time=(TMR_3MS)*32.08333MSINCFTMR_8SEC,F(xiàn);8SEC=32.08333MS*256=8.213333336SECTMR_TIME;Time=(TMR_8SEC)*8.213333336SECNOPBSFADCON0,_GO;StartA/DBSFMFH,AD;SetA/DStartedFlagBSFMFH,_PWM;_PWM=1->ReadnextSampleSKIP_IF_SETMF,COPW;andPWMS????GOTORFBEG;0->NotPWMMode->BlockTXorRX;SetNewDutyCyclePWMSample8bitSAMPle<70>;CCPR1L<70>CCP1CON<54>;|0|0||||||||||;/||;Sampe<72>Sample<10>;SWAPFSample,WANDLW30;W<54>=Sample<10>BCFCCP1CON,4BCFCCP1CON,5;CCP1CON<54>=00IORWFCCP1CON,F(xiàn);CCP1CON<54>=Sample<10>RRFSample,WMOVWFSample_TMPRRFSample_TMP,W;W<50>=Sample<72>ANDLW3FMOVWFCCPR1L;CCPR1L=00Sample<72>;------PWMSampleEnd------RF_BEG;BeginBlockRFTXorRFRXSKIP_IF_SETFRF,_BUSYGOTORF_END;BUSY=0WaitStartRFRX/TXDECFSZM8CNT,F(xiàn)GOTORF_8KHZ;#0Not1KHZ(1KHZ=1MS=8*125U);M8CNT=00Yes1KHZ=1002.6MSTX|RXBarkerorCurr.Data|RXSYNCBSFM8CNT,3;M8CNT=08hSKIP_IF_NOTMF,RFTXGOTORF_TX;1TX&amp;1KHZ(&amp;COPW=PWMS=0)=>TXSKIP_IF_NOTFRF,_CURGOTORX_CUR;1WaitCurrentData-BitSKIP_IF_NOTFRF,_BARGOTORX_BAR;1WaitBarker-BitRF_8KHZSKIP_IF_NOTFRF,_BAR;If_BAR=1SYNCFull=>GOTORF_END;Wait1KHZonlyforBarkerorData;CurrentSinc-Bit=SYNCijMOVFM8CNT,WSUBLWBTM0+8;8->BTM0,7->BTM1,..,1->BTM7MOVWFFSRBSFSTATUS,_CSKIP_IF_SETRX_DATA_P,RX_DATA;RC4BCFSTATUS,_CRLFINDF,F(xiàn);ShiftbittoCorrelator;CompareCorrelatorSKIP_IF_EQULINDF,-SYNC01B;RFBitsInverse.Skipif==GOTORXNO;NotSync-ByteINCFRF_CNT,F(xiàn)GOTORF_ENDRXNO;NotSync-ByteMOVLWSYNC5RSUBWFRF_CNT,W;(W)=(RF_CNT)-5BTFSCSTATUS,_CGOTORXOK;C=1(RF_CNT)&gt;=5CLRFRF_CNT;(RF_CNT)<5->StartSYNCagainGOTORF_ENDRXOKBCFSTATUS,_CRRFRF_CNT,W;W=RF_CNT/2SUBLW07;W=8-RF_CNT/2-1=7-RF_CNT/2MOVWFM8CNT;YesSYNC.Detected.LockCLKBSFFRF,_BARMOVLWGARK_TO;MaxBitsbeeforeBARKERMOVWFRF_CNT;UsedLikeTimeoutCounterCLRFRF_BYTE;UsedLikeBARKERDetectorBufferGOTORF_ENDRX_BAR;WaitBarkerBSFSTATUS,_CSKIP_IF_SETRX_DATA_P,RX_DATA;RC4BCFSTATUS,_CRLFRF_BYTE,F(xiàn);C=xxxxxxxxX,X=NextBit,MSBFirstSKIPIFNEQULRF_BYTE,-BARKERB;SkipifNotBarkerGOTORX_BAR_OK;YesBarker,DetectesBarkerOKDECFSZRF_CNT,F(xiàn);NotBarker->CheckTimeOutGOTORF_ENDCLRFFRF;TimeOutReset,NotBARStartSYNCagainBSFFRF,ERR;ERRBarkerFRF,_ERR=1(FRF,_BUSY=0)MOVLW81MOVWFRF_BYTE;81=ErrorCode=BarkerErrorGOTORX_ERRRX_BAR_OK;BarkerOK,PreparetoRXCurrentBytesBSFFRF,_CURMOVLWBTMO;BuffCOHM=BuffRFRXMOVWFRF_FSRBCFFRF,_NIBGOTORF_CUR_END;PrepareRF_BYTE=FChforCurr.BytesRX_CUR;1Wait(Processing(O6PA6OTKA))CurrentData-BitBCFSTATUS,__C;BitsInverse?。?!IMustBSFSTATUS,_CSKIP_IF_SETRX_DATA_P,RX_DATA;RC4BSFSTATUS,_C;BitsInverse?。?!IMustBCFSTAtuS,_CRLFRF_BYTE,F(xiàn);C=11..100x..xX,X=NextBit,MSBFirstSKIP_IF_NCGOTORF_D;C=11..100x..xx;C=00xxxxxxx=7BitReceived,StoreNibbleMOVFRF_FSR,WMOVWFFSR;IndirectAddressBUFi.RRFRF_BYTE,W;CutoffBit0,(W)=00xxxxxxANDLW1F;CutoffBit6,(W)=000xxxxxCALLDecodeTable;(W)=Decode(W)=0000NNNN,NNNN=NibbleNOP;US(forCEIBOOTLADKA)SKIPIFNOTFRE,_NIBGOTORX_CUR_L;1->LowNibbleRXMOVWFINDF;0HiNibbleReceivetoRFBUFSWAPFINDF,F(xiàn)BSFFRF,_NIB;NextLowNibbleGOTORF_CUR_END;PrepareRF_BYTE=FChRX_CUR_L;LowNibbleRXIORWFINDF,W;(W)=AllByteMOVWFINDFINCFRF_FSR,F(xiàn);TonextByteBUFRFBCFFRF,_NIB;NextHiNibbleSKIP_IF_NOTFRF,_NLENGOTORX_CUR_B;1NotLength-Byte,CurrentByteSKIP_IF_NOTFRF,_TYPRGOTORX_CUR_LENG;1NotType-Byte,toLength-ByteBSFFRF,_TYPR;ReceivType-Byte,nextLength-ByteMOVWFSRF_KS;KSGOTORF_CUR_END;PrepareRF_BYTE=FChRX_CUR_LENGBSFFRF,_NLEN;ReceivLength-Byte,nextCurrentByteMOVWFRX_CNT;ForCOHMRFADDWFSRF_KS,F(xiàn);KSADDLW01;+1(BytewithKS)MOVWFRF_CNTGOTORF_CUR_END;PrepareRF_BYTE=FChRX_CUR_BDECFSZRF_CNT,F(xiàn)GOTORF_CUR_KS;CurrentByteReceivedKS+=Cur.Byte;RFReceiveFinishCompareKSCLRFFRF;FRF,_BUSY=0.KSOKFRF,_ERR=0MOVWFRF_BYTE;RF_BYTE=RXKSSKIP_IF_WEQUSRF_KS;Skipif(W)=KSGOTORX_ERR;RFRXSuccessfulComplete(Finish)OK!->toPCTOY-RF-HUB-UART->PCBSFMF,COHMRFGOTORF_ENDRX_ERRBSFFRF,_ERR;ERRFRF,_ERR=1GOTORF_ENDRF_CUR_KS;CurrentByteReceivedADDWFSRF_KS,F(xiàn);KS+=Cur.ByteRF_CUR_END;PrepareRF_BYTE=FChMOVLWOFCMOVWFRF_BYTEGOTORF_END;---------------------------------------------;---------RFDataTransmitting;RF_TXRLFRF_BYTE,F(xiàn);SendNextBittoRF,MSBFirstSKIP_IF_CGOTORFTXOBSFTX_DAT_P,TX_DATA;RA2=1GOTOTX_DECRFTXOBCFTX_DATA_P,TX_DATA;RA2=0TX_DEC;DecrementBitCounterDECFSZRF_CNT,F(xiàn)GOTORF_ENDBSFRF_CNT,3;RF_CNT=8BitsRLFRF_BYTE,F(xiàn);RF_BYTE=SYNC-Byteagain01010101SKIP_IF_NOTFRF,_CURGOTOMTX_CUR;1YesBARker,TransmitsCurrenthalf-BytesDECFSZRFMCNT,F(xiàn);5*8bitsSYNCGOTORF_END;EndSync,TransmitsBarker-Byte00110010(SendBARKER),;butbeforePrepareTransmitsCurrenthalf-Bytes(0-15Bytes)BCFFRF,_NIB;0->Hi-NibbletoTX/1->LowNibbleBSFFRF,_CUR;YesBARker,TransmitsCurrenthalf-BytesMOVLWBARKERBMOVWFRF_BYTE;RFTXByteBarker=00110010MTX_CUR;TransmitsCurrenthalf-Bytes,SendMessageMOVFRF_FSR,WMOVWFFSR;IndirectAddressBUFiSKIP_IF_SETFRF,_NIBGOTOMTX_CUR_H;0->HiNibbletoTXMOVFINDF,W;LowNibbletoTX,W=(BUFi)=Byte<70>INCFRF_FSR,F(xiàn);TonextByteBUFRFBCFFRF,_NIB;NextHiNibbleGOTOMTX_CUR_L;LowNibbleReadytoEncodingandRXTXMTX_CUR_HSWAPFINDF,W;W=Byte<30>Byte<74>=>HiNibbleBSFFRF,_NIB;=1=NextLowNibbleMTXCURLANDLWOFhCALLEncodeTable;W=Encode(W)=<71>0NOP;USMOVWFRF_BYTEDECFRF_CNT,F(xiàn);RF_CNT=7Bits(=8-1)DECFSZTX_CNT,F(xiàn);CounterBytesMessagetoTXGOTORF_END;TX_CNTO=2*(Length+3(TYPE,LENG,KS));RFTXFinished,MessageFullyTransmits?。?!CLRFFRF;FRF,_BUSY=0BCFMF,RFTX;RFTransmitFinish->RFRXGOTORF_ENDRF_END;EndBlockRFTXorRFRXSKIP_IF_SETMFH,TSTPWGOTOIRET;0=NoTestPWM0001..FEFE..;TestPC->HUBPWM0001..FEFE(#FF)00..SKIP_IF_EQULMM11PW,OFF;SkipifMM11PW#FFhGOTOTST_NOFF;W#FFhMOVLWOFE;=FFh->W(wǎng)=FEhGOTOTST_FETST_NOFFMOVFMM1PW,WTST_FESKIP_IF_SETMFH,TSMPLGOTOIRET;0SampleNotchangedBCFMFH,TSMPL;1Samplerenewed(O6HOBILOC6)(=0)INCFMM11PW,F(xiàn)SKIP_IF_WNEQUSample;Skipif(W)#SampleGOTOIRET;W=Sample->OKNOP;US;MM11PW#Sample->TestErrorDECFMM11PW,F(xiàn);RestoreMM11PW;UCALLIMPULSMOVLWOEEMOVWFMSTATUSSKIP_IF_NLELTMR_32MS,20GOTOIRET;Time<32MS*32=1.024SecBSFFCOHM,_MES;MessageErrorBSFMF,COHMIRET;MOVFPCLATH_TMP,W;MOVWFPCLATH;RestorePCLATHINT_RESTOREEND;04.02.981900Microch.asmPIC16C7xMichaelKholodet;01.04.9814001.Comment19h=>99h;--------------------------------------------;--------------------------------------------INDFEQU00;&amp;80h;IndirectAccessRegisterTMROEQU01;Timer0Register.SeeAlsoOPTIONRBits;FO=Fosc/4/Presc/(256-TMRO)=Fosc/4/[2^(OPTION<20>+1)]/(256-TMR0);TMR0=256-Fosc/4/[2^(OPTION<20>+1)]/FOOPTIONREQU01;81hOptionsRegister_RBPUEQU7;1-PORTBpull-uparedisabled_INTEDGEQU6;1-IntonRisingEdgeofRBO/INTpin_TOSCEQU5;TMROClockSource1-External(RA4)0-Internal_TOSEEQU4;ExternalEdge_PSAEQU3;PrescallerAssigment1-WDT0-Timer0;2;PrescallerValue;1;TMROPresc=2^Value+112,141256;0;WDTPresc=2^Value11,12,...1128PCLEQU02;&amp;82h;ProgramCounterSTATUSEQU03;&amp;83h;StatusRegister_IRPEQU7;Reg.BankBitforIndirectAddr.0=00-0FF,1=100-1FF_RP1EQU6;Reg.BankBitSelectforDirectAddr._RP0EQU5;00=00-7F,01=80-0FF_ZEQU2;ZeroFlag_CEQU0;CarryFlagFSREQU04;&amp;84h;IndirectAddressingRegisters;I/OPortsRegistersPORTAEQU05TRISAEQU05;85hPORTBEQU06TRISBEQU06;86hPORTCEQU07TRISCEQU07;87h_RXEQU7;USARTRXPinRC7_TXEQU6;USARTTXPinRC6PCLATHEQU0A;&amp;8Ah;InterruptRegistersINTCONEQU0B;&amp;8B;InterruptsConfig.Register_GIEEQU7;GlobalIntEnableBit_PEIEEQU6;PeripheralIntEnableBit_T0IEEQU5;Timer0IntEnableBit_T0IFEQU2;Timer0IntFlagPIR1EQU0C;InterruptsStatusFlagsRegister_ADIFEQU6;A/DIntFlag_RCIFEQU5;USARTReceiveIntFlag_TXIFEQU4;USARTTransmitIntFlag_SSPIFEQU3;SSPIntFlag_CCP1IFEQU2;TMR1CaptureIntFlag_TMR2IFEQU1;TMR2=PR2IntFlag_TMR1IFEQU0;TMR1OverflowIntFlagPIE1EQU0C;8Ch;PeripheralIntsControlRegister_ADIEEQU6;A/DConverterIntEnableBit_RCIEEQU5;USARTReceiveIntEnableBit_TXIEEQU4;USARTTransmitIntEnableBit_SSPIEEQU3;SSPIntEnableBit_CCP1IEEQU2;CCP1IntEnableBit_TMR2IEEQU1;TMR2=PRIntEnableBit_TMR1IEEQU0;TMR1overflowIntEnableBitTMR1LEQU0E;HoldingRfortheLeastSignif.ByteofTMR1RegTMR1HEQU0F;Hold.RegfortheMostSignificantByteof16-bTMR1T1CONEQU10;TimerlControlRegister;Bit5-4Prescale11-18,10-14,01-12,00-11_TMR1ONEQU0;1=>Enables/0=>StopsTIMER1T2CONEQU12;Timer2ControlRegister;Bit6-3Postscale0000-1,0001-2,...1111-16_TMR2ONEQU2;1=>Timer2On;Bit1-0Prescaler00-1,01-4,1x-16PR2EQU12;92hTimer2PeriodRegPR2=(Fosc/[4*Fuser*Presc])-1;SSPModuleRegistersSSPBUFEQU13;SSPBufferRegisterSSPCONEQU14;SyncSerialPortControlRegister_WCCOLEQU7;WriteCollisionBit(0-NoCollision)_SSPOVEQU6;ReceiveowerflowIndicator(0-Noowerflow)_SSPENEQU5;SSPEnableBit_CKPEQU4;ClockPolarityBit;Bits3-0ModeSelectSSPSTATEQU14;94h;SSPStatusRegister_BFEQU0;BufferFullStatusBit;Capture/Compare/PWMModule1CCPR1LEQU15;Capture/Compare/PWMRegister1LSBCCPR1HEQU16;Capture/Compare/PWMRegister1MSBCCP1CONEQU17;Capture/Compare/PWMControlRegister1_CCP1M0EQU0;Bit3-00100=Falling/0101=Rising;USARTModuleRegistersRCSTAEQU18;ReceiveStatus&amp;ControlRegister_SPENEQU7;SerialPortEnableBit_RX9EQU6_SRENEQU5_CRENEQU4;ReceiveEnableBit_FERREQU2;FramingErrorBit_OERREQU1;OverrunErrorBit_RX9DEQU0TXSTAEQU18;89h;TransmitStatus&amp;ControlRegister_CSRCEQU7;ClockSourceSelect_TX9EQU6;9-BitTransmitEnableBit_TXENEQU5;TransmitEnableBit_SYNCEQU4;ModeSelectBit1-Synchronous,0-Asychronous_BRGHEQU2;HiBaudSelectt1-Hi,0-Low_TRMTEQU1;TransmitStatus1-Empty,0-Full_TX9DEQU0;9thbitofDataTXREGEQU19;TranceiveRegisterSPBRGEQU19;99h;BaudRateRegisterBaud=Fosc/[64(SPBRG+1)]RCREGEQU1A;ReceiveRegister;Capture/Compare/PWMModule2CCPR2LEQU1B;Capture/Compare/PWMRegister1LSBCCPR2HEQU1C;Capture/Compare/PWMRegister1MSBCCP2CONEQU1D;Capture/Compare/PWMControlRegister2;A/DConvertorModuleRegistersADRESEQU1E;A/DConvertionResultADCON0EQU1F;A/DPortConfig.Register_ADCS1EQU7;A/DClockSelectBits_ADCS0EQU6;00-Fosc/201-Fosc/810-Fosc/3211-Frc;Bits5-3-ChannelSelect0-7_GOEQU2;A/DConversionStatus/StartBit_ADONEQU0;A/DConverterModuleOn/OffADCON1EQU1F;9Fh;A/DPortChannelsSelectBits;----------------------------------------------------;*******MACRO*******;----------------------------------------------------SELECT_BANK_0MACRObcfSTATUS,_RP0;0bank0ENDMSELECT_BANK_1MACRObsfSTATUL_RP0;1bank1ENDMSKIP_IF_ZMACRObtfssSTATUS,_Z;SkipifZEROZ=1ENDMSKIP_IF_NZMACRObtfscSTATUS,_Z;SkipifNotZEROZ=0ENDMSKIP_IF_CMACRObtfssSTATUS,_C;SkipifC=1ENDMSKIP_IF_NCMACRObtfscSTATUS,_C;SkipifC=0ENDMSKIP_IF_SETMACROReg,BitbtfssReg,Bit;SkipifBit=1ENDMSKIP_IF_NOTMACROReg,BitbtfscReg,Bit;SkipifBit=0ENDMSKIP_IF_NLESSMACROX,Y;SkipifX>=Y(jié)movfY,WsubwfX,W;W=X-Y/*ifwasbarrowCarry=0*/btfssSTATUS,_C;SkipifX>=Y(jié)(C=1)ENDMSKIP_IF_LESSMACROX,Y;SkipifX<YmovfY,W;W=Y(jié)subwfX,W;W=X-Y/*ifwasbarrowCarry=0*/btfscSTATUS,_C;SkipifX<Y(C=0)ENDMSKIP_IF_EQULMACROX,L;Skipif(X)=(L)MOVFX,WXORLWLSKIP_IF_Z;Skipif(X)=(L)ENDMSKIP_IF_NEQULMACROX,L;Skipif(X)#(L)MOVFX,WXORLWLSKIP_IF_NZ;Skipif(X)#(L)ENDMSKIP_IF_WEQULMACROL;Skipif(W)=(L)XORLWLSKIP_IF_Z;Skipif(W)=(L)ENDMSKIP_IF_WNEQULMACROL;Skipif(W)#(L)XORLWLSKIP_IF_NZ;Skipif(W)#(L)ENDMSKIP_IF_WEQUMACROX;Skipif(W)=(X)XORWFX,WSKIP_IF_Z;Skipif(W)=(X)ENDMSKIP_IF_WNEQUMACROX;Skipif(W)#(X)XORWFX,WSKIP_IF_NZ;Skipif(W)#(X)ENDMSKIP_IF_LELMACROX,L;SkipifX<LMOVLWL;W=LSUBWFX,W;W=X-L/*ifwasbarrowCarry=0*/btfscSTATUS,_C;SkipifX<L(C=0)ENDMSKIP_IF_NLELMACROX,L;SkipifX>=LMOVLWL;W=LSUBWFX,W;W=X-L/*ifwasbarrowCarrv=0*/btfssSTATUS,_C;SkipifX>=L(C=1)ENDMSKIP_IFM_LELMMACROX,L,M;Skipif(X,X+1)<L,MMOVLWLSUBWFX,W;W=(X)-LSKIP_IF_CGOTOS+7;C=0->(X)<L->SkipSKIP_IF_Z;C=1->(X)>=LGOTOS+4;NotZero->(X)>L->NotSkipMOVLWM;(X)=L->check(X+1),MSUBWFX+1,W;W=(X+1)-MSKIP_IF_NC;Skipif(X,X+1)<L,MENDMSKIP_IFM_NLELMMACROX,L,M;Skipif(X,X+1)>=L,MMOVLWLSUBWFX,W;W=(X)-LSKIP_IF_CGOTOS+6;C=0->(X)<L->NotSkipSKIP_IF_Z;C=1->(X)>=LGOTOS+5;NotZero->(X)>L->SkipMOVLWM;(X)=L->check(X+1),MSUBWFX+1,W;W=(X+1)-MSKIP_IF_C;Skipif(X,X+1)>=L,MENDMSKIP_IFM_LESSMACROX,Y;Skipif(X,X+1)<(Y,Y+1)movfY,WsubwfX,W;W=(X)-(Y)SKIP_IF_CGOTOS+7;C=0->(X)<(Y)->SkipSKIP_IF_Z;C=1->(X)>=(Y)GOTOS+4;NotZero->(X)>(Y)->NotSkipmovfY+1,W;(X)=(Y)->check(X+1),(Y+1)subwfX+1,W;W=(X+1)-(Y+1)SKIP_IF_NC;Skipif(X,X+1)<(Y,Y+1)ENDMSKIP_IFM_NLESSMACROX,Y;Skipif(X,X+1)>=(Y,Y+1)movfY,WsubwfX,W;W=(X)-(Y)SKIP_IF_CGOTOS+6;C=0->(X)<(Y)->NotSkipSKIP_IF_Z;C=1->(X)>=(Y)GOTOS+5;NotZero->(X)>(Y)->SkipmovfY+1,W;(X)=(Y)->check(X+1),(Y+1)subwfX+1,W;W=(X+1)-(Y+1)SKIP_IF_C;Skipif(X,X+1)>=(Y,Y+1)ENDMSKIP_IFM_ZMACROX;Skipif(X)=(X+1)=00hMOVFX,F(xiàn)SKIP_IF_ZGOTOS+3;(X)#00hMOVFX+1,F(xiàn);(X)=00hSKIP_IF_Z;Skipif(X)=(X+1)=00hENDMSKIP_IFM_NZMACROX;Skipif(X)#00h.or.(X+1)#00hMOVFX,F(xiàn)SKIP_IF_ZGOTOS+4;(X)#00h=>SkipMOVFX+1,F(xiàn);(X)=00hSKIP_IF_Z;Skipif(X)#00h.or.(X+1)#00hENDMINCMMACROX;X=(XH,XL)=X++(+=1)INCFSZX+1,F(xiàn)GOTOS+2INCFX,F(xiàn);X=(XH,XL)=X++(+=1)ENDMDECMMACROX;X=(XH,XL)=X--(-=1)MOVFX+1,F(xiàn)SKIP_IF_NZDECFX,F(xiàn);(XL)=(X+1)=0->(XH)--(-=1)DECFX+1,F(xiàn)ENDMINT_STOREMACROmovwfW_TMP;StoreWtoW_TMPinbankoneorzeroswapfSTATUS,W;StoreswappedSTATUStoWCLRFSTATUS;0bank0movwfSTATUS_TMP;StoreswappedSTATUStoSTATUS_TMPinBank0MOVFFSR,WMOVWFFSR_TMP;StoreFSRtoFSR_TMPENDMINT_RESTOREMACROSELECT_BANK_0;0bank0MOVFFSR_TMP,WMOVWFFSR;RestoreFSRswapfSTATUS_TMP,W;LoadWwithStoredSTATUSmovwfSTATUS;RestoreSTATUSandBankswapfW_TMP,1;SwapW_TMPswapfW_TMP,W;SwapW_TMPtoWRETFIEENDM;06.04.981930MHfifo8K.asmFIFO8KBMichaelKnolodenko,Creator;06.4;2.BF=42,BYTE=43(before40,41);16.31.OnlyGG=RC5.NotGl(RC4)NotG2;;19.21.ChangeG1=RC4(NotA2=TEST),(CTS=RC1inMH.asm);12.21.DeleteNOP-sin″B_IN″,″B_OUT″;--------------------------------------------------;******Constants******;--------------------------------------------------BC_restEQU10;=16BCH_maxEQU20;8K->20,SETBCM0BCM=8192=2000hB0x1FEQU1F;8K->1F;--------------------------------------------------;*****Variables******;--------------------------------------------------BFEQU42;FlagsFWEQU1;0->BUFampty(FR=0)orfull(FR=1)FREQU0BYTEEQUBF+1;->s/rBUF_R,BUF_W,B_IN_OUTBCMEQUBF+2;BCM+1EQUBF+5.Counter->s/rBUF_R,BUF_W;BCM+1EQUBF+3;BCM+BAW-BAR=2000hor0000hBARHEQUBF+4;Addressforread->s/rBUF_R,BUF_WBARLEQUBF+5BAWHEQUBF+6;Addressforwrite->s/rBUF_R,BUF_WBAWLEQUBF+7BPORTEQUPORTBBTRISEQUTRISBBGGPORTEQUPORTCBGGTRISEQUTRISCBGGEQU5;GG=BGGPORT,B_GG=PORTC,5RC5BWEPORTEQUPORTCBWETRISEQUTRISC;_B_WEEQU0;WE=BWEPORT,B_WE=PORTC,0RC0BOEPORTEQUPORTABOETRISEQUTRISA;_B_OEEQU5;OE=BOEPORT,B_OE=PORTA,5RA5;---------------------------------------------------------;MacroB_IN-inputBytefromFIFO8K->toBYTE.;(FIFOaddress&lt;120&gt;=BARH&lt;40&gt;&amp;BARL&lt;70&gt;);---------------------------------------------------------B_INMACROBCFBGGPORT,B_GG;GG=0MOVFBARL,WMOVWFBPORT;Address&lt;70&gt;=B_ADL&lt;70&gt;BSFBGGPORT,B_GG;GG=1RC5_|--MOVFBARH,WMOVWFBPORT;Address&lt;128&gt;=B_AdH&lt;40&gt;BCFBGGPORT,B_GG;GG=0RC4--|_MOVLW0FFSELECT_SANK_1MOVWFBTRIS;FF-&gt;inputdataBYTEinPORTBSELECT_BANK_0;_OE,WEBCFBOEPORT,B_OE;OE=001-read(input)RA5MOVFBPORT,WBSFBOEPORT,B_OE;OE=111-Now/rRA5MOVWFBYTE;read(input)inBYTESELECT_BANK_1CLRFBTRIS;00->outputdataBYTEinPORTBSELECT_BANK_0ENDM;---------------------------------------------------------;MacroB_OUT-outputBytetoFIFO8K<-fromBYTE.;(FIFOaddress&lt;120&gt;=BAWH&lt;40&gt;&amp;BAWL&lt;70&gt;);---------------------------------------------------------B_OUTMACROBCFBGGPORT,B_GG;GG=0MOVFBAWL,WMOVWFBPORT;Address&lt;70&gt;=B_ADL&lt;70&gt;BSFBGGPORT,B_GG;GG=1RC5_|--MOVFBAWH,WMOVWFBPORT;Address&lt;129&gt;=B_ADH&lt;40&gt;BCFBGGPORT,B_GG;GG=0RC5--|_MOVFBYTE,W;__MOVWFBPORT;_OE,WEBCFBWEPORT,B_WE;WE=010-write(output)RC0BSFBWEPORT,B_WE;WE=111-Now/rRC0EMDM;----------------------------------------------------;*****BUF_SET-setupBUF-FIFO*****BUF_SETSELECT_BANK_1;MOVLW05;PinRA0,RA1-Analog,RA2-D,RA3-Vref;MOVLW07;PinRA0-RA7=D;MOVWFADCON1NOP;__;SetOE,WE,GG->Out;110BCFBOETRIS,B_OE;A.5=p07RA5BCFBWETRIS,B_WE;A.4=p06RC0BCFBGGTRIS,B_GG;C.5=p16RC5NOPSELECT_BANK_0BSFBOEPORT,B_OE;/OE=1RA5BSFBWEPORT,B_WE;/WE=1RC0BCFBGGPORT,B_GG;GG=0RC5NOPCLRFBCM+1;BCL=00hMOVLWBCH_maxMOVWFBCM;BCM=2000h=longBUF;(BAR)=(BAW)=0000CLRFBARHCLRFBARLCLRFBAWHCLRFBAWLCLRFBFCLRFBPORTSELECT_BANK_1NOPCLRFBTRIS;outputaddr7-0;PrepareRTSPinforOutputSELECT_BANK_0NOPBCFRTS_PORT,RTS_BIT;RC3=RTS=0toRecivefromPC?。?!SELECT_BANK_1NOPbcfRTS_TRIS,RTS_BIT;RC3->OutputSELECT_BANK_0NOPRETURN;;--------------------------------------------------;*****BUF_W-writeBYTEfromWinBUFfer;*****BUF_R-readBYTEinWfromBUFfer;exitC=0-OK,C=1-notw/r(BUFamptyorfull);BAW=(BAWH,BAWL)-addressforwrite;BAR=(BARH,BARL)-addressforread;;BCM=(BCM=BCH,BCM+1=BCL)-buffercounter;(W)=(BYTE)forsavebytesource;BF-buffersflags;BF,1=FW,BF,0=FR;;BCM(hex)BCMBF,WR;;0_0_<=01-BUFferfull;1|1|<=11-nowrite;2|2|;.....;10h|_16_|<=11-nowrite;11h|16+1|<=10-writeandread;12h|18|;13h|19|<=10-writeandread;14h|20|;.....;.....;1FFE|8190|;1FFF|8191|<=10-writeandread;2000h|8192|<=00-BUFferempty;********;;--------------------------------------------------;BUF_R-readBYTEinWfromBUFfer;exitC=0-OK,C=1-notread(BUFempty);--------------------------------------------------BUf_RMOVWFBYTE;save(W)BTFSCBF,F(xiàn)WGOTOB_R;li;0i=>BUFemptyorfullBTFSSBF,F(xiàn)RGOTOBRWE;00=>BUFempty;01=>BUFfull->read,andthenBF,WR=BF&lt;10&gt;=11BSFBF,F(xiàn)W;readbytefromBUFferB_RB_ININCFSZBARL,F(xiàn)GOTOB_R2;FF+1=>+100INCFBARH,WANDLWB0x1F;longBUF=8192=>0-1FFFMOVWFBARHB_R2INCMBCM;BCMcounter+=1MOVEBCM,WSKIP_IF_NZGOTOB_R0;BCH=0->BCM<256SUBLWBCH_max;BCH=20h?SKIP_IF_ZGOTOBRW_OK;BCH#20h;BCH=20h->BCM=2000h->BUFempty->;->BF,WR=00(before10)BCFBF,F(xiàn)WB_R0;BCM<256MOVFBCM+1,WSKIP_IF_WNEQULBC_rest+1;SkipifBCM#16+1GOTOB_R17;BCM=17SKIP_IF_WEQULBC_rest+20;SkipifBCM=16+32=48GOTOBRW_OK;BCM<48;BCM=481.EnableFILLINGBUF!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!bcfRTS_PORT,RTS_BIT;RC3=0->EnableGOTOBRW_OKB_R17BCFBF,F(xiàn)R;BCM=16+1->BF,WR=10(before11)GOTOBRW_OK;;---------------------------------------------------;****BUF_W-writeBYTEfromWinBUFfer;exitC=0-OK,C=1-notwrite(BUFfull);---------------------------------------------------BUF_WMOVWFBYTE;save(W)=bytesourceBTFSCBF,F(xiàn)WGOTOB_W;1i;0i=>BUFemptyorfullBTFSCBF,F(xiàn)RGOTOBRWE;01=>BUFfull;00=>BUFempty->write,andthenBF,WR=10BSFBF,F(xiàn)W;writeBYTEinBUFferB_WB_OUTINCFSZBAWL,F(xiàn)GOTOB_W2;FF+1=>+100INCFBAWH,WANDLWB0x1F;longBUF=8192=>0-1FFFMOVWFBAWHB_W2;(((=>BRW_OK??NO)))DECMBCM;BCMcounter-=1SKIP_IFM_ZBCM;SkipifBCM=0000GOTOB_W4;BCM>0;BCM=0->BUFfull->BF,WR=01(before11)BCFBF,F(xiàn)WGOTOBRW_OKB_W4MOVFBCM,F(xiàn)SKIP_IF_ZGOTOBRW_OK;BCH=0->BCM<256MOVFBCM+1,WSUBLWBC_restSKIP_IF_ZGOTOBRW_OK;BCM=16->BF,WR=11(before10)BSFBF,F(xiàn)R;1.STOPFILINGBUF!!?。。。。。。。。。。。。。。。。。。。。。。。。。。。。?!bsfRTS_PORT,RTS_BIT;RC3BRW_OKBCFSTATUS,_CGOTOBRW_ENDBRWEBSFSTATUS,_C;C=1Notr/wBRW_ENDMOVFBYTE,WRETURN玩具控制裝置源代碼系列單端口摩托羅拉玩具控制裝置源代碼***************************************************************************************************FILEcru.asmDATE25/07/97*Sinclude″motorola.h″;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;StoryTellerDemo.;Januar1988;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;***************************************************************************************************BEEP_PIN_PORTEQUPORTABEEP_PIN_DDREQUDDRABEEP_PIN_BITEQU0TX_DATA_PORTEQUPORTDTX_DATA_DDREQUDDRDTX_DATA_BITEQU5MUTE_PORTEQUPORTAMUTE_DDREQUDDRAMUTE_BITEQU1MOTOR_1_PORTEQUPORTBMOTOR_1_DDREQUDDRBMOTOR_1_BITEQU5LED_PORTEQUPORTBLED_DDREQUDDRBLED_BITEQU6MOTOR_2_PORTEQUPORTBMOTOR_2_DDREQUDDRBMOTOR_2_BITEQU7RF_EN_PORTEQUPORTARF_EN_DDREQUDDRARF_EN_BITEQU3SENSE_3_PORTEQUPORTASENSE_3_DDREQUDDRASENSE_3_BITEQU5SENSE_2_PORTEQUPORTASENSE_2_DDREQUDDRASENSE_2_BITEQU6SENSE_1_PORTEQUPORTASENSE_1_DDREQUDDRASENSE_1_BITEQU7CLK_PORTEQUPORTCCLK_DDREQUDDRCCLK_BITEQU0POWER_LOCK_PORTEQUPORTA;″1″=ONPOWER_LOCK_DDREQUDDRAPOWER_LOCK_BITEQU2TX_B2_PORTEQUPORTATX_B2_DDREQUDDRATX_B2_BITEQU4LOW_BATT_PORTEQUPORTC;ANAILOGINPUT-AN3LOW_BATT_DDREQUDDRCLOW_BATT_BITEQU4CAR_DETECT_PORTEQUPORTCCAR_DETECT_DDREQUDDRCCAR_DETECT_BITEQU3LDT_PORTEQUPORTCLDT_DDREQUDDRCLDT_BITEQU5RSSIPORTEQTPORTC;ANALOGINPUT-AN0RSSI_DDREQUDDRCRSSI_BITEQU6********************************************************************RX_DATA_PORTEQUPORTD;PORTDRX_DATA_DDREQUDDRD;DDRDRX_DATA_BITEQU7DATA_PORTEQUPORTCDATA_DDREQUDDRCDATA_BITEQU1;SAMEPINASTXRX_PLL_DATA*********************************************************************;COPREGISTERSCOP_BITEQUS1D;COPBITCOP_REGISTEREQUS1FF0;COPREGISTERIRQ_OPT_REGEQUS1FDFIRQ_OPT_VALEQUS00;EDGETRIGGEREDINTERRUPT;;*******************************************************************;TIMERCONSTANTS&amp;REGISTERS;;WITHCRYSTALOF4MHZ,THETIMERINCREMENTSEVERY2US.TCR_REGEQUS12;TIMERCONTROLREGOLVL_BITEQUS00;OUTPUTLEVELBITPOSITIONINTCR.IEDG_BITEQUS01;1=POSITIVEEDGETRIGGERSINPUTCAPTUREICIE_BITEQUS07;1=INPUTCAPTUREIRQENABLE(TCAP/PD7)TOIE_BITEQUS05;1=TIMEROVERFLOWIRQENABLEOCIE_BITEQUS06;1=OUTPUTCOMPAREIRQENABLE(TCMP)TSR_REGEQUS13;TIMERSTATUSREGISTERICRE_REGEQUS14;INPUTCAPTUREREGHIGHICRL_REGEQUS15;INPUTCAPTUREREGLOWTIMER_HIGHEQUS18;TIMERHIGHREGISTERTIMER_LOWEQUS19OCR_HIGHEQUS16;OUTPUTCOMPAREREGISTERNSBINMEMORYOCR_LOWEQUS17;*****************************************************************************************************************************************STARTOFRAM********************************************************************ORGS80WAIT_REG1RMB1;RESERVE1BYTEFORWAITREGISTERWAIT_REG2RMB1REG1RMB1REG2RMB1REG3RMB1REG4RMB1TXRX_BYTERMB1TXRX_TRAN_BUFFRMB5;TRANSMITBUFFERTXRX_REC_BUFFRMB5;RECEIVEBUFFER;DECLARE_FLAGSFLAGS_BYTERMB1OK_FLAGEQU0REC_BITEQU1MIDI_OK_FLAGEQU2;USEDINMIDIPROCSYNC_DET_FLAGEQU3IF_FLAGEQU4FIND_SYNC_FLAGEQU5FIND_BIT_FLAGEQU6CAPTURE_FLAGEQU7FLAGS1_BYTERMB1MIC_OPEN_FLAGEQU3;MicrophonewasopenbyListenStartBIT_DTCTED_FLAGEQU4BIT_DETECTED_BITEQU5BIT_DET_FAIL_FLEQU6REC_HEADER_FLAGEQU7BYTE_DTCTED_FLAGEQU7;SAMEASHEADERFLAGSYNC_COUNTERRMB1TIMER_MSB_BYTERMB1TIMER_LSB_BYTERMB1TIMER_DIFF_MSBRMB1TIMER_DIFF_LSBRMB1kbd_counter_msbrmb1kbd_counter_lsbrmb1kbd_counter_11equ!01kbd_counter_12equ!100;Onetimecounterspwm_reg1rmb1pwm_reg2rmb1pwm_reg1rmb1;ZeroTimeCounterspwm_reg1_zrmb1pwm_reg2_zrmb1pwm_reg1_zrmb1;One/ZeroTimeDurationin100msone_time1rmb1one_time2rmb1zero_time1rmb1zerotime2rmb1;Motors/LEDEnableFlagsRegisterml_enablermb1;******XOL*******Tmp1db0Tmp2db0Tmp3db0headerbitcntrdb0;TimeWordCounterCounter_Lowdb0Counter_Hidb0;******Compander’sPLLWriteOnlyDataShadowMemoryPllShadowPll1Hidb0Pll1Lodb0Pll2Hidb0Pll2Lodb0Pll3Hidb0Pll3Lodb0Pll4Hidb%00011000;(18h)ALC-Enable,Limiter-Enable,Clk-Disable;|||/+----->VolumeControl(MSB);|||\------->ClkOutSelect;||+-------->1-ClkDisable;|+--------->1-LimiterDisable;+----------->1-ALCDisablePll4Lodb%00000000;(00h)Mode-Activ,Tx-UnMuted,Rx-Muted,SP-On;/||||+----->1-SpeakerMute;||||+------>1-RxMute;|||+------->1-TxMute;||+-------->RxMode\00-Active;|+--------->StendByMode/11-Inactive;+---------->VolumeControl(bit2-LSB)Pll5Hidb0Pll5Lodb0Pll6Hidb%00000000;\_/;+------>VoltageReferenceAdjustPll6Lodb%11000000;||\__/;||+------->FilterClockCounter;|+----------->1-TxScramblerBypass;+------------>1-RxScramblerBypassPll7Hidb0Pll7Lodb0;******DefaultPLLSettings(descriptionseeupword)REG1HIEQU00hREG1LOEQU00hREG2HIEQU00hREG2LOEQU00hREG3HIEQU00hREG3LOEQU00hREG4HIEQU08hREG4LOEQU0A7hREG5HIEQU3EhREG5LOEQU0C0hREG6HIEQU00hREG6LOEQU0CAhREG7HIEQU00hREG7LOEQU00h***********************************************************;COSTANTSMIDI_START_BYTEEQUS90UNIT_CODE_NUMBEREQUS21;UNIT_CODE_NUMBEREQUS22;UNIT_CODE_NUMBEREQUS23;UNIT_CCDE_NUMBEREQUS24;Book;UNIT_CODE_NUMBEREQUS25;Frog;UNIT_CODE_NUMBEREQUS26;UNIT_CODE_NUMBEREQUS27BASE_CODE_NUMBEREQUS98BROADCASTEQUS055h*******************************************************************;unitcommanddeclarationsunit_OLDtalk_cmdequS10unit_talk_cmdequS80unit_mic_t_cmdequS90unit_mic_st_cmdequS21unit_mic_stop_cequS22unit_general_cmdequS70unit_status_cmdequS80unit_reset_cmdequS0a0unit_turn_off_cequS0a3unit_turn_on_cmdequS0a5;******XOLunit_compand_cmdequS60set_scriptequS30;******ENDXOL;******ToyTalkFlagsLISTEN_AFTERequS08hMOTOR1_ENABLEequS01hM1_ENABLE_BITequS00hMOTOR2_ENABLEequS02hM2_ENABLE_BITequS01hLED_ENABLEequS04hLED_ENABLE_BITequS02h**********************************************************************STARTOFPROGRAM**********************************************************************sssORGS100START_OP;;;INITINTERRUPTTYPERSP;RESETSTACKPOINTERLDA#IRQ_OPT_VALSTAIRQ_OPT_REGsei;DISABLEIRQ;jsrshutt_on;supplyvoltagetotherestoftheboardJSRTXRX_INIT_PINS;INITTO′0′JSRTXRX_SET_FREQJSRSPKR_INIT;XOLDelaylda#70jsrwait_acc_ms;ENDXOLlda#unit_reset_cmdldx#1statxrx_rec_buff,x;jsrsend_ack;ResetDelayJSRBEEP_INITJSRBEEP_1lda#!60jsrwait_acm_100ms;delay6secJSRBEEP_INITJSRBEEP_1jsrsend_ackMAINJSRTIMER_INIT;andenableirqfromthereceiverlda#kbd_counter_11stakbd_counter_msbclrkbd_counter_lsb;XOLPrimatySetupForCompander′sPLL;******EnableSIOPinMasterModelda#50hstaSCRjsrSetupPllPortjsrReqSetup;WriteDefaultstoRegs&amp;Shadowlda#070h;Delayjsrwait_acc_ms;StopScriptlda#0FFhjsrSendM;ENDXOLCLI;ENABLEALLIRQSNOPMAIN_LOOPnopMAIN_1BRCLRSYNC_DET_FLAG,F(xiàn)LAGS_BYTE,MAIN_2jsrwait_rf_mssg_2;gettherfmessagebrclrsync_det_flag,flags_byte,main_1_1;msgfail?BCLRSYNC_DET,F(xiàn)LAGS_BYTESEI;DISABLEALLIRQSjsrdecode_cmdmain_1_1JSRTIMER_INIT;andenableirqfromthereceiverCLI;ENABLEALLIRQSMAIN_2deckbd_counter_lsbbnemain_3deckbd_counter_msbbnemain_3lda#kbd_counter_11stakbd_counter_msbSEI;DISABLEALLIRQSjsrscan_sensorCLI;ENABLEALLIRQSmain_3;CheckEndofListenTimebrclrMIC_OPEN_FLAG,F(xiàn)LAGS1_BYTE,MAIN_LOOP;MicClosedbrsetTOIE,TCR,MAIN_LOOP;TimerStillWork;CloseMicrophonejsrListenClose;SetTx-On,Rx-Mute,Spk-Mute;StopScriptlda#0FFhjsrSendMBRAMAIN_LOOP;*******************************************************************scan_sensorjsrget_sensorcmp#S0ffbeqscan_sensor_exitlda#unit_status_cmdlda#1statxrx_rec_buff,xjsrsend_acklda#kbd_counter_12;longertimefornextscantime.stakbd_counter_msb;StopCurrentScript;lda#0FFh;jsrSendMscan_sensor_exitrts;*******************************************************************GET_SENSOR;checkifasensorispressedandifso,returnavalueintheACC;ifnosensor,thentheACC=FFclrabrsetSENSE_1_bit,SENSE_1_port,get_sensor_1lda#!03braget_sensor_exitget_sensor_1brsetSENSE_2_bit,SENSE_2_port,get_sensor_2lda#!01braget_sensor_exitget_sensor_2brsetSENSE_3_bit,SENSE_3_port,get_sensor_3lda#!02braget_sensor_exitget_sensor_3lda#S0ffget_sensor_exitrts**********************************************************************SEND_ACK;sendanacktothebaseunitofacommandthatwasjustreceived.;format&lt;base#&gt;&lt;unit#&gt;&lt;command_byte&gt;&lt;sensorstatus&gt;&lt;0&gt;;CheckBroadcast.ifyes-noACKldatxrx_rec_buffcmp#BROADCASTbeqsend_ack_exitclrx;;placethebaseidnumberlda#base_code_numberstatxrx_tran_buff,xincx;x=1;placetheunit#lda#unit_code_numberstatxrx_tran_buff,x;;placethecommandldatxrx_rec_buff,xincx;x=2statxrx_tran_buff,xincx;x=3;placethesensorsstatusjsrget_sensorstatxrx_tran_buff,xincx;;place0lda#S00statxrx_tran_buff,xjsrtx_rf_stringsend_ack_exitrts;***************************************************************SEND_ACK_COMPAND;sendanacktothebaseunitofacompandercommand.;format&lt;base#&gt;&lt;unit#&gt;&lt;command_byte&gt;&lt;compander_MSB&gt;&lt;compander_LSB&gt;clrx;;placethebaseidnumberlda#base_code_numberstatxrx_tran_buff,xincx;x=1;;placetheunit#lda#unit_code_numberstatxrx_tran_buff,x;;placethecommandldatxrx_rec_buff,xincx;x=2statxrx_tran_buff,xand#07hdecaasla;CalculateMSBIndexinShadowtax;X-indexofMSBldaPllShadow,Xstatxrx_tran_buff+3;LoadMSBincx;ldaPllShadow,Xstatxrx_tran_buff+4;LoadLSBjsrtx_rf_stringrts;****************************************************************;*****************************************************************;startUnitcommands;**************************************************************;*******************************************************************decode_cmd;decodeunitcommands.bclrICIE_BIT,TCR_REG;INPUTCAPTUREIRQDISABLEDSEI;DISABLEALLIRQSldx#S00ldatxrx_rec_buff,x;unitnumbercmp#unit_code_numberbeqdo_decode_cmdcmp#BROADCAST;checkbroadcastbnedecode_cmd_exitdo_decode_cmdincx;commandbyteldatxrx_rec_buff,xand#0F0hcmp#unit_OLDtalk_cmdbnedecode_cmd_111jsrunit_OLDtalkldatxrx_rec_buff+1;restoreAbradecode_cmd_exitdecode_cmd_111ldatxrx_rec_buff+1;restoreAand#0F0hcmp#unit_talk_cmdbnedecode_cmd_1jsrunit_talkldatxrx_rec_buff+1;restoreAbradecode_cmd_exitdecode_cmd_1ldatxrx_rec_buff+1;restoreAcmp#unit_mic_c_cmdbnedecode_cmd_2jsrunit_mic_c_timebradecode_cmd_exitdecode_cmd_2cmp#unit_mic_st_cmdbnedecode_cmd_3jsrunit_mic_startbradecode_cmd_exitdecode_cmd_3cmp#unit_mic_stop_cbnedecode_cmd_4jsrunit_mic_stopbradecode_cmd_exitdecode_cmd_4cmp#unit_reset_cmdbnedecode_cmd_5jsrunit_resetbradecode_cmd_exitdecode_cmd_5cmp#unit_turn_off_cbnedecode_cmd_6jsrunit_turn_offbradecode_cmd_exitdecode_cmd_6cmp#unit_general_cmdbnedecode_cmd_7jsrunit_generalbradecode_cmd_exit;******XOLdecode_cmd_7and#0F0h;selectHinibblecmp#unit_compand_cmdbnedecode_cmd_8jsrcompander_cmdldatxrx_rec_buff+1;restoreAbradecode_cmd_exit;******ENDXOLdecode_cmd_8ldatxrx_rec_buff+1;restoreAcmp#set_scriptbnedecode_cmd_9jsrset_script_cmdbradecode_cmd_exitdecode_cmd_9nopdecode_cmd_exitCLI;ENABLEALLIRQSbsetICIE_BIT,TCR_REG;INPUTCAPTUREIRQENABED;jsrled_offrts;*************************************************************unit_talk;NewToyTalk2;commandsyntax&lt;unitid#&gt;&lt;unit_talk_cmd&gt;&lt;talk_time&gt;&lt;listen_time&gt;&lt;script&gt;;&lt;script&gt;TTTTTTLL;|+-----ListenScript2bit;+--------TalkScript;jsrsend_ack;ackok;SendScrlptCommandldatxrx_rec_buff+4;loadscriptBytelsralsra;TalkScript-00TTTTTTjsrSendM;OpenTalkChanneljsrTalkOpen;SetCompanderRx-OnSpk-Onlda#!50jsrwait_acc_ms;delaybeforeunmutespkjsrspkr_muce_offldatxrx_rec_buff+2;loadTalkTimestareg1;reg1=TalkTimebequnit_talk_exunit_talk_1;TalkDelaylda#0FFhjsrwait_acc_msdecreg1bneunit_talk_1unit_talk_ex;CloseTalkChanneljsrTalkClose;SetCompanderRx-MuteSpk-Mutejsrspkr_mute;StopScriptlda#0FFhjsrSendM;ListenAfterjmpdo_listen_after;*****************************************************************;*******************************************************************unit_OLDtalk;talkfortime;commandsyntax&lt;unitid#&gt;&lt;unit_talk_cmd&gt;&lt;time_mab&gt;&lt;time_lsb&gt;&lt;listen&gt;;talkfortime_msb*time_lsb*100ms;unit_talk_cmd=0001XXXX;||||-----------Motor0Enable;|||-------------Motor1Enable;||---------------LedEnable;|-----------------ListenAfterTalkjsrsend_ack;ackok;******XOLjsrTalkOpen;SetCompanderRx-OnSpk-On;jsrMUX_RX_TO_SP;SendScript0clrajsrSendMlda#!150jsrwait_acc_ms;delaybeforeunmutespkjsrspkr_mute_offldx#!2ldatxrx_rec_buff,x;time_msbstareg1unit_OLDtalk_1ldx#!3ldatxrx_rec_buff,x;time_lsbjsrwait_acc_100msldareg1bequnit_OLDtalk_exitdecreg1bneunit_OLDtalk_1unit_OLDtalk_exit;******XOLjsrTalkClose;SetCompanderRx-MuteSpk-Mutejsrspkr_mute;StopScriptlda#0FFhjsrSendMunit_OLDtalk_ex2rts;**************************************************************unit_mic_time;ToyListenTime2;commandsyntax&lt;unitid#&gt;&lt;toy_listen_time_cmd&gt;&lt;XX&gt;&lt;listen_time&gt;&lt;script&gt;;&lt;script&gt;xxxxxxLL+-----ListenScript2bitjsrsend_ack;ackokdo_listen_after;checkifListenldatxrx_rec_buff+3beqlisten_time_ex;SendScriptCommandldatxrx_rec_buff+4;loadscriptByteand#03hora#40h;ListenScript010000LLjsrSendM;OpenListenChanneljsrListenOpen;SetTx-Mute,Rx-On,Spk-On;SetAlarmtimer;TimerTick=131.072msbclrTOIE,TCRclrastaCounter_Hildatxrx_rec_buff+3staCounter_Low;******XOLjsrListenOpen;SetTx-Mute,Rx-On,Spk-On;EnableAllIntstoreceivecommandscli;WaitAsinchronioslyforCounterStoplisten_time_exrts;****************************************************************set_script_cmdjsrsend_ack;ackok.ANDMUXtxrxTOMCU;storedutycycletimesldatxrx_rec_buff+2jsrSendMrts;****************************************************************;****************************************************************unit_mic_start;listen&amp;transmitthemicrophone.jsrsend_ack;ackok.ANDMUXtxrxTOMCUbclrTOIE,TCRlda#0FFhstaCounter_LowclrCounter_HijsrListenOpen;SetTx-Mute,Rx-On,Spk-On;EnableAllIntstoreceivecommandsclirts;********************************************************************unit_mic_stop;stoplistenningforthemicrophone.jsrListenClose;SetCompanderTx-Mutejsrsend_ack;ackokrts;*******************************************************************unit_reset;resettheunit.jmpstart_op;********************************************************************unit_turn_off;shuttoffthepowertothecircuit.enterpowersavemode.jsrsend_ack;ackokjsrshutt_off;allpins=0&amp;inputs&amp;turnoffvoltage;stop;stoposc.irqorreset>exittoRESET.unit_turn_off_1jmpunit_turn_off_1;********************************************************************unit_general;ageneralcommand.eachunitcanhaveadifferentdatafields&amp;actiontothat;command.jsrsend_ack;ackokldx#!2ldatxrx_rec_buff,x;motordirectioncmp#!1bneunit_general_1;jsrmotor_leftbraunit_general_exunit_general_1cmp#!2bneunit_general_ex;jsrmotor_rightunit_general_exrts;****************************************************************;****************************************************************;startofRFproc;****************************************************************;****************************************************************;oz;------------------------------------------------------------------------_;rfgeneralproc;------------------------------------------------------------------------_;****************************************************************;****************************************************************;TXRX_TEST;CLRX;TXRX_TEST_L;LDAMIDI_TEST_STR,X;STATXRX_TRAN_BUFF,X;INCX;CPX#5;BNETXRX_TEST_L;JSRTX_RF_STRING;;RTS;****************************************************************test_compare;comparethereceived4bytestothetestbytesinrom.clrxtest_compare_1ldamidi_test_str,xcmptxrx_rec_buff,xbnetest_comp_exitincxcpx#5bnetest_compare_1LDA#50JSRBEEP_2;jsrblink_led2test_comp_exitrts;****************************************************************TXRX_INIT_PINS)BCLRCLK_BIT,CLK_PORTBSETCLK_BIT,CLK_DDR;OUTPUTBCLRDATA_BIT,DATA_PORTBSETDATA_BIT,DATA_DDRBCLRRF_EN_BIT,RF_EN_PORTBSETRF_EN_BIT,RF_EN_DDRBSETTX_B2_BIT,TX_B2_PORT;TXBUFFERAMPCONTROLINPUT.ACTIVELOWBSETTX_B2_BIT,TX_B2_DDRBSETTX_B2_BIT,TX_B2_PORT;TXVCOCONTROLINPUT.ACTIVELOW.BSETTX_B2_BIT,TX_B2_DDRBCLRTX_DATA_BIT,TX_DATA_PORT;DATAPIN=0BSETTX_DATA_BIT,TX_DATA_DDR;OUTBCLRLDT_BIT,LDT_DDR;SetLDTpintoInputRTS;*******************************************************************TRANSMITTER_ONBCLRTX_B2_BIT,TX_B2_PORTRTS;*******************************************************************TRANSMITTER_OFFBSETTX_B2_BIT,TX_B2_PORTRTS;*******************************************************************TXRX_SET_FREQ;INITTHETRANCEIVERFORATX&amp;RXFREQUENCY.;ozLDA#!100JSRWAIT_ACC_MS;;;Frx=926.9875N=75895LDA#S05STAREG1LDA#S28STAREG2LDA#S77STAREG3JSRTXRX_PRG_19_BITS;;;Ftx=902.9875N=72239LDA#S03STAREG1LDA#S1ASTAREG2LDA#S2FSTAREG3JSRTXRX_PRG_19_BITSLDA#S3DSTAREG1LDA#S48STAREG2LDA#S00STAREG3JSRTXRX_PRG_14_BITSLDA#S0A;0ASTAREG1LDA#S00STAREG2LDA#S00STAREG3JSRTXRX_PRG_14_BITSRTS;********************************************************************TXRX_PRG_19_BITS;PROGRAMTHEPLLWITH19BITS;BITSARESTOREDINREG1,REG2,REG3;REG1=3MSBBITS;REG2=8MIDDLEBITS;REG3=8LSBBITSBCLRCLK_BIT,CLK_PORTBCLRDATA_BIT,DATA_PORTBCLRRF_EN_BIT,RF_EN_PORTLDX#8LDAREG3;GET8LSBBITSJSRTXRXPLLPRGLDX#8LDAREG2;GET8JSRTXRX_PLL_PRGLDX#3LDAREG1;GET3MSBBITSJSRTXRX_PLL_PRGBSETRF_EN_BIT,RF_EN_PORT;STROBEPULSENOPNOPNOPNOPNOPNOPBCLRRF_EN_BIT,RF_EN_PORTBCLRCLK_BIT,CLK_PORTBCLRDATA_BIT,DATA_PORTRTS;****************************************************************TXRX_PRG_14_BITS;PROGRAMTHEPLLWITH14BITS;BITSARESTOREDINREG1,REG2,REG3;REG1=6MSBBITS;REG2=8LSBBITS;REG3=NCBCLRCLK_BIT,CLK_PORTBCLRDATA_BIT,DATA_PORTBCLRRF_EN_BIT,RF_EN_PORTLDX#8LDAREG2;GET8LSBBITSJSRTXRX_PLL_PRGLDX#6LDAREG1;GET6MSBBITSJSRTXRX_PLL_PRGBSETRF_EN_BIT,RF_EN_PORTNOPNOPNOPNOPNOPNOPBCLRRF_EN_BIT,RF_EN_PORTBCLRCLK_BIT,CLK_PORTBCLRDATA_BIT,DATA_PORTRTS;****************************************************************TXRX_PLL_PRG;PROGRAMTHEPLLWITHTHEBYTESTOREDINACCANDWITHTHENUMBER;OFBITSSTOREDINWAIT_REG1LSRABCCTXRX_PLL_PRG_1BSETDATA_BIT,DATA_PORTBRATXRX_PLL_PRG_2TXRX_PLL_PRG_1BCLRDATA_BIT,DATA_PORTTXRX_PLL_PRG_2NOPNOPNOPBSETCLK_BIT,CLK_PORTNOPNOPNOPNOPBCLRCLK_BIT,CLK_PORTDECKBNETXRX_PLL_PRGNOPNOPBCLRDATA_BIT,DATA_PORTNOPNOPRTS;****************************************************************TIMER_INIT;INITTHEINPUTCAPTURE;BCLRIEDG_BIT,TCR_REG;NEGATIVEEDGEBSETIEDG_BIT,TCR_REG;PositiveedgeEDGE;BCLRTOIE_BIT,TCR_REG;TIMEROVERFLOWIRQDISABLEDBCLROCIE_BIT,TCR_REG;OUTPUTCOMPAREIRQDISABLEBSETICIE_BIT,TCR_REG;INPUTCAPTUREIRQENABLEDBCLRSYNC_DET_FLAG,F(xiàn)LAGS_BYTE;WILLBESETWHENSYNCDETECTEDCLRSYNC_COUNTERBSETFIND_SYNC_FTAG,F(xiàn)LAGS_BYTE;FINDSYNCMODEBCLRFIND_BIT_FLAG,F(xiàn)LAGS_BYTE;NOTINFINDRFBITMODELDATSR_REG;ANDCLRTHEICFIRQBITLDAICRL_REG;BCLRTEST_PIN1_BIT,TEST_PIN1_PORT;′1′=OFF;BSETTEST_PIN1_BIT,TEST_PIN1_DDR;OUTPUT;BCLRTEST_PIN2_BIT,TEST_PIN2_PORT;′1′=OFF;BSETTEST_PIN2_BIT,TEST_PIN2_DDR;OUTPUT;CLI;ENABLEALLIRQSRTS;*******************************************************************WAIT_NO_CARR;WAITTILLNOCARRIER,THENOK_FLAG=1;USESACCBSETOK_FLAG,F(xiàn)LAGS_BYTEBRSETCAR_DETECT_BIT,CAR_DETECT_PORT,W_NO_CARR_EXLDA#!100;100MSW_NO_CARR_LOOPJSRWAIT_1MSBRSETCAR_DETECT_BIT,CAR_DETECT_PORT,W_NO_CARR_EXDECABNEW_NO_CARR_LOOPBCLROK_FLAG,F(xiàn)LAGS_BYTEW_NO_CARR_EXRTS;*******************************************************************WAIT_TO_CARR;WAITTILLCARRIER,THENOK_FLAG=1;USESACC,XBSETOK_FLAG,F(xiàn)LAGS_BYTEBRCLRCAR_DETECT_BIT,CAR_DETECT_PORT,W_TO_CARR_EXLDA#!200;204.8MSLDX#!0;256*8=2048CYC=1.024msW_TO_CARR_LOOPBRCLRCAR_DETECT_BIT,CAR_DETECT_PORT,W_TO_CARR_EX;5CYCDECX;3CYCBNEW_TO_CARR_LOOP;3CYCDECABNEW_TO_CARR_LOOPBCLROK_FLAG,F(xiàn)LAGS_BYTEW_TO_CARR_EXRTS;*******************************************************************;rfreceiverproc;*******************************************************************WAIT_RF_mssg;iftheRFmessagewasreceivedfinethentheSYNC_DET_FLAG=″1″;timeoutafteraprx600msJSRTIMER_INITLDX#!200LDA#!255;256*11us=2.8MSWAIT_RF_MSSG_1BRSETSYNC_DET_FLAG,F(xiàn)LAGS_BYTE,WAIT_RF_MSSG_2;5CYCDECA;3CYCBNEWAIT_RF_MSSG_1;3CYCDECXBNEWAIT_RF_MSSG_1;3CYCBRAW_RF_MSSG_FAIL;brawait_rf_mssg_1MAIT_RF_MSSG_2JSRREC_HEADERBRSETREC_HEADER_FLAG,F(xiàn)LAGS1_BYTE,WAIT_RF_MSSG_3BRAW_RF_MSSG_FAILWAIT_RF_MSSG_3JSRDETECT_STRBRCLRBYTE_DTCTED_FLAG,F(xiàn)LAGS1_BYTE,W_RF_MSSG_FAILNOP;jsrtest_comoare;BLINKLEDIFOKBRAW_RF_MSSG_EXITW_RF_MSSG_FAILBCLRSYNC_DET_FLAG,F(xiàn)LAGS_BYTEW_RF_MSSG_EXITRTS;****************************************************************REC_HEADER;afterdetectingthesync,needtowaitfor1byteofheader.;firstwaitforthefirstbitBSETFIND_BIT_FLAG,F(xiàn)LAGS_BYTE;THETIMERWILLDETECTBITSCLRTXRX_BYTEclrheader_bit_cntrLDX#!10;10*5.3ms=53mstosearchLDA#!255;5.3msSTAREG2REC_HEADER_LBRSETBIT_DTCTED_FLAG,F(xiàn)LAGS1_BYTE,REC_HEADER_BIT;5CYCBRSETBIT_DET_FAIL_FAIL_FL,F(xiàn)LAGS1_BYTE,REC_HEADER_BADBRSETCAR_DETECT_BIT,CAR_DETECT_PORT,REC_HEADER_FAIL;NOCARRIERDECREG2;3CYCBNEREC_HEADER_L;3CYCDECXBNEREC_HEADER_L;;5+5+5+3+3=21BRAREC_HEADER_FAILREC_HEADER_BAD;failedsoclrthetxrx_byteCLRTXRX_BYTEclrheader_bit_cntrBCLRBIT_DTCTED_FLAG,F(xiàn)LAGS1_BYTEBCLRBIT_DET_FAIL_FL,F(xiàn)LAGS1_BYTEBRAREC_HEADER_LREC_HEADER_BIT;bitdetectedok,sorotatethetxrx_byteuntildetectstheheaderbyte.BCLRBIT_DTCTED_FLAG,F(xiàn)LAGS1_BYTEBCLRBIT_DET_FAIL_FL,F(xiàn)LAGS1_BYTEBRSETBIT_DETECTED_BIT,F(xiàn)LAGS1_BYTE,REC_HEADER_BIT1CLCBRAREC_HEADER_BIT2REC_HEADER_BIT1SECREC_HEADER_BIT2ROLTXRX_BYTEincheader_bit_cntrldaheader_bit_cntrcmp#08h;ifnumberofreceivedbits<8bcsREC_HEADER_L;don′tcheckToyNumber-getnextbit;CheckAndCloseMicrophonebrclrMIC_OPEN_FLAG,F(xiàn)LAGS1_BYTE,mic_closedjsrListenClosemic_closedLDATXRX_BYTECMP#UNIT_CODE_NOMBERbeqok_Continuecmp#BROADCAST;CheckBroadcastBNEREC_HEADER_Lok_ContinuestaTXRX_REC_BUFF;StoreReceivedByteBSETREC_HEADER_FLAG,F(xiàn)LAGS1_BYTEBRAREC_HEADER_EXITREC_HEADER_FAILBCLRREC_HEADER_FLAG,F(xiàn)LAGS1_BYTEREC_HEADER_EXITNOPRTS;****************************************************************DETECT_STR;detect4morebytesaftertheheader.;BCLRIEDG_BIT,TCR_REG;NEGATIVEEDGEBSETIEDG_BIT,TCR_REG;NEGATIVEEDGECLRX;LDA#UNIT_CODE_NUMBER;STATXRX_REC_BUFF,XINCXDETECT_STR_LJSRDETECT_BYTEBRCLRBYTE_DTCTED_FLAG,F(xiàn)LAGS1_BYTE,DETECT_STR_FAILLDATXRX_BYTESTATXRX_REC_BUFF,X;BCLRIEDG_BIT,TCR_REG;NEGATIVEEDGE.preparefornextbyteBSETIEDG_BIT,TCR_REG;NEGATIVEEDGEINCXCPX#!5BNEDETECT_STR_LBRADETECT_STR_EXITDETECT_STR_FAILNOPDETECT_STR_EXITBCLRFIND_BIT_FLAG,F(xiàn)LAGS_BYTE;THETIMERWILLSTOPDETECTBITSRTS;****************************************************************DETECT_BYTE;detect8bitsfromthereceiver.;saveresultinTXRX_BYTEBCLRBYTE_DECTED_FLAG,F(xiàn)LAGS1_BYTECLRTXRX_BYTELDA#!8STARFG3;COUNTERLDA#!5;4*5.3ms=21mstosearchSTAREG1LDA#!255;5.3msSTAREG2DETECT_BYTE_LBRSETBIT_DTCTED_FLAG,F(xiàn)LAGS1_BYTE,DETECT_BYTE_BIT;SCYCBRSETBIT_DET_FAIL_FL,F(xiàn)LAGS1_BYTE,DETECT_BYTE_BFBRSETCAR_DETECT_BIT,CAR_DETECT_PORT,DETECT_BYTE_FAIL;NOCARRIERDECREG2;3CYCBNEDETECT_BYTE_L;3CYCDECREG1BNEDETECT_BYTE_L;5+5+5+3+3=21BRADETECT_BYTE_FAILDETECT_BYTE_BIT;bitdetectedok,sorotatethetxrx_byteuntildetects8bits.BCLRBIT_DTCTED_FLAG,F(xiàn)LAGS1_BYTEBCLRBIT_DET_FAIL_FL,F(xiàn)LAGS1_BYTEBRSETBIT_DETECTED_BIT,F(xiàn)LAGS1_BYTE,DETECT_BYTE_BIT1CLCBRADETECT_BYTE_BIT2DETECT_BYTE_BF;thefirsttimetocheckabytewegetfail(becauseofthespacebetweenone;bytetotheother.soifthefailappearsatbit#0wecontinuetocheck.BCLRBIT_DET_FAIL_FL,F(xiàn)LAGS1_BYTE;INITLDAREG3CMP#!8BEQDRYECT_BYTE_LBRADETECT_BYTE_FAIL;NOTTHEFIRSTBITSOFAILDETECT_BYTE_BIT1SECDETECT_BYTE_BIT2ROLTXRX_BYTEDECREG3BNEDETECT_BYTE_LBSETBYTE_DTCTED_FLAG,F(xiàn)LAGS1_BYTEBRADETECT_BYTE_EXITDETECT_BYTE_FAILNOPDETECT_BYTE_EXITRTS;********************************************************************TIMER_SYNC;CheckIntSourcebrclrTOF,TSR,Capture_Int;ClearTOFldaTRL;DecrementWordCounterldaCounter_Lowsub#01hstaCounter_LowbccCheck_Zero;if(!Carry)gotoCheck_ZerodecCounter_Hi;elsedecCounter_HiCheck_Zero;CheckifWordCounter==0oraCounter_Hi;Counter_LolCount.bneTOI_Exit;notZero;ZeroinCounter.DisablenextOverilowIntbclrTOIE,TCRTOI_ExitrtiCapture_Int;JUMPTOTHISROUTINEWHENDETECTSHIGHTOLOWININPUTCAPTUREPIN(PD7#25);eachtimertickis2us(4mhzcrystal)andthecountercountsup(0-ffff).BSETCAPTURE_FLAG,F(xiàn)LAGS_BYTE;SETCAPTUREFLAG;NEEDTOCLRTHEICFFLAGBYREADINGTHETSRREGANDICRLREG.;BCLRTEST_PIN2_BIT,TEST_PIN2_PORT;BCLRTEST_PIN1_BIT,TEST_PIN1_PORTLDATSR_REGLDAICRL_REG;INPUTCAPTUREREGLOW.BRSETCAR_DETECT_BIT,CAR_DETECT_PORT,TIMER_SYNC_FLIL;NOCMRRIERCLCSBCTIMER_LSB_BYTE;LASTRESULTOFINPUTCAPTURESTATIMER_DIFF_LSB;DIFFERENTVALUELDAICRH_REG;INPUTCAPHIGHSBCTIMER_MSB_BYTESTATIMER_DIFF_MSB;;NOWSAVECAURRENTCAPTUREVALUELDAICRH_REGSTATIMER_MSB_BYTELDAICRL_REGSTATIMER_LSB_BYTEBRSETFIND_BIT_FLAG,F(xiàn)LAGS_BYTE,TIMER_SYNC_BITBRCLRFIND_SYNC_FLAG,F(xiàn)LAGS_BYTE,TIMER_SYNC_EXITJSRCHECK_TIME;CHECKIF400<t<600usBRCLRIF_FLAG,F(xiàn)LAGS_BYTE,TIMER_SYNC_FAILINCSYNC_COUNTERLDASYNC_COUNTERCMP#!10BNETIMER_SYNC_EXIT;BCSBSETSYNC_DET_FLAG,F(xiàn)LAGS_BYTEBSETFIND_SYNC_FLAG,F(xiàn)LAGS_BYTECLRSYNC_COUNTERBRATIMER_SYNC_EXITTIMER_SYNC_BITJSRBIT_TIMERBRATIMER_SYNC_EXITTIMER_SYNC_FAILCLRSYNC_COUNTERCLRSYNC_DET_FLAGNOPTIMER_SYNC_EXITNOPRTI;*******************************************************************BIT_TIMER;EACHRFBITISWITHINTHETIMEOF750us;″1″=700usCYCLE;″0″=1200USCYCLEBCLRBIT_DTCTED_FLAG,F(xiàn)LAGS1_BYTE;initBCLRBIT_DET_FAIL_FL,F(xiàn)LAGS1_BYTE;initBCLRBIT_DETECTED_BIT,F(xiàn)LAGS1_BYTE;statusofthedetectedbit;CACULATETHEBITWHENTHERXWASIN″0″ORIN″1″;SAVERESULTINTIMER_ZERO_H,TIMER_ZERO_LORINTIMER_ONE_H,TIMER_ONE_L;IF200us<ZEROTIME<250usAND;;;thedetectedperiodisCYCLE;;--------------------------JSRIF_ZERO_TIMEBRCLRIF_FLAG,F(xiàn)LAGS_BYTE,BIT_TIMER_1BSETBIT_DTCTED_FLAG,F(xiàn)LAGS1_BYTE;initBCLRBIT_DETECTED_BIT,F(xiàn)LAGS1_BYTE;statusofthedetectedbitBRABIT_TIMER_EXITBIT_TIMER_1JSRIF_ONE_TIMEBRCLRIF_FLAG,F(xiàn)LAGS_BYTE,BIT_TIMER_FAILBSETBIT_DTCTED_FLAG,F(xiàn)LAGS1_BYTE;initBSETBIT_DETECTED_BIT,F(xiàn)LAGS1_BYTE;statusofthedetectedbitBRABIT_TIMER_EXITBIT_TIMER_FAILBSETBIT_DET_FAIL_FL,F(xiàn)LAGS1_BYTE;initBIT_TIMER_EXITRTS;*******************************************************************CHECK_TIME;wewillcheck600us(275=113h)(THEACTUALTIMEIS525US/2=106H);and400us(200=0c8h)BSETIF_FLAG,F(xiàn)LAGS_BYTELDATIMER_DIFF_MSBCMP#S02;=2BCCCHECK_TIME_FAIL;BIGGER/EQUL02xxHCME#S01;=1BNECHECK_TIME_ALDATIMER_DIFF_LSB;MSB=1,SOCHECKALSOLSBCMP#S20;14BCCCHECK_TIME_FAILBRACHECK_IME_EXIT;OKCHECK_TIME_A;=0LDATIMER_DIFF_LSB;MSB=0SOCHECKLSB.CMP#S0E0;C8BCSCHECK_TIME_FAILBRACHECK_TIME_EXITCHECK_TIME_FAILBCLRIF_FLAG,F(xiàn)LAGS_BYTECHECK_TIME_EXITRTS;*******************************************************************IF_ONE_TIME;eachtimertickis2us(4mhzcrystal);the″1″cycleis700usandthe″0″cycleis1200us;700/2=350=15e(wewillcheck600/2=300=12cand800/2=400=190);1200/2=600=258h(wewillcheck1100/2=550=226and1300/2=650=28a)BSETIF_FLAG,F(xiàn)LAGS_BYTELDATIMER_DIFF_MSBCMP#S01;=1BNEIF_ONE_TIME_FAILLDATIMER_DIFF_LSB;MSB=1,SOCHECKALSOLSBCMP#S2CBCSIF_ONE_TIME_FAILCMP#S9FBCCIF_ONE_TIME_FAIL;bsetTEST_PIN2_BIT,TEST_PIN2_PORTBRAIF_ONE_TIME_EXIT;OKIF_ONE_TIME_FAILBCLRIF_FLAG,F(xiàn)LAGS_BYTEIF_ONE_TIME_EXITRTS;*******************************************************************IF_ZERO_TIME;eachtimertickis2us(4mhzcrystal);the″1″cycleis700usandthe″0″cycleis1200us;700/2=350=15e(wewillcheck600/2=300=12cand800/2=400=190);1200/2=600=258h(wewillcheck1100/2=550=226and1300/2=650=28a)BSETIF_FLAG,F(xiàn)LAGS_BYTELDATIMER_DIFF_MSBCMP#S02;=1BNEZERO_TIME_FAILLDATIMER_DIFF_LSB;MSB=1,SOCHECKALSOLSBCMP#S26BCSZERO_TIME_FAILCMP#S9ABCCZERO_TIME_FAIL;bsetTEST_PIN1_BIT,TEST_PIN1_PORTBRAZERO_TIME_EXIT;OKZERO_TIME_FAILBCLRIF_FLAG,F(xiàn)LAGS_BYTEZERO_TIME_EXITRTS;*******************************************************************;*******************************************************************;-------------------------------------------------------------------;rftxproc;----------------------------------------------------------;***********************************************************TX_RF_STRING;TRANSMITASTRINGOF5BYTES-TXRX_TRAN_BUFF;THESTRINGISSTOREDINTXRX_TRAN_BUFF;USESACC,X;SEI;DISABLEIRQbclrICIE_BIT,TCR_REG;INPUTCAPTUREIRQDISABLEDBCLRTX_DATA_BIT,TX_DATA_PORT;DATAPIN=0;JSRMUX_TXRX_TO_MCUJSRTRANSMITTER_ONjsrCompanderOff;SetCompandertonotActivemode;WaitForPLLLockPositiveLevelofLDTWait_LDTbrclrLDT_BIT,LDT_PORT,Wait_LDTLDA#!120JSRWAIT_ACC_MSJSRTX_RF_SYNCLDX#0TX_RF_STR_LOOPLDATXRX_TRAN_BUFF,XJSRTX_RF_BYTEINCXCPX#!5BNETX_RF_STR_LOOP;TXLOWTOCOMPLETELASTBIT;---------------------------BCLRTX_DATA_BIT,TX_DATA_PORT;DATAPIN=0JSRWAIT_100USJSRWAIT_100USJSRWAIT_100USBSETTX_DATA_BIT,TX_DATA_PORT;DATAPIN=1LDA#5JSRWAIT_ACC_MSJSRTRANSMITTER_OFFjsrCompanderOn;SetColandertoActiveMode;TX_RF_STRIN_EXIT;CLI;enableALLIRQSbsetICIE_BIT,TCR_REG;INPUTCAPTUREIRQENABLEDRTS;*******************************************************************TX_RF_BYTE;TRANSMIT1BYTE.MSBFIRST;″1″=CYCLEOF700US,″0″=CYCLEOF1200US(SYNC=CYCLEOF500US);sendmsbfirst.;SAVETHISBYTEINACCBEFOREEXECUTINGTHISROUTINE.;USESACC,REG1STXREG1LDX#08TX_RF_BYTE_LLSLABCCTX_RF_BYTE_1;TX″1″;------BCLRTX_DATA_BIT,TX_DATA_PORT;DATAPIN=0JSRWAIT_100USJSRWAIT_100USJSRWAIT_100USBSETTX_DATA_BIT,TX_DATA_PORT;DATAPIN=1JSRWAIT_100USJSRWAIT_100USJSRWAIT_100USJSRWAIT_100USBRATX_RF_BYTE_2TX_RF_BYTE_1;TX″0″;------BCLRTX_DATA_BIT,TX_DATA_PORT;DATAPIN=1JSRWAIT_500USJSRWAIT_100USBSETTX_DATA_BIT,TX_DATA_ORT;DATAPIN=0JSRWAIT_500USJSRWAIT_100USTX_RF_BYTE_2DECXBNETX_RF_BYTE_LLDXREG1RTS;*******************************************************************TX_RF_SYNC;TRANSMIT30CYCLESOF500USASSYNC;LDA#!30TX_RF_SYNC_LBCLRTX_DATA_BIT,TX_DATA_PORT;DATAPIN=1JSRWAIT_100USJSRWAIT_100USJSRWAIT_100USBSETTX_DATA_BIT,TX_DATA_PORT;DATAPIN=1JSRWAIT_100USJSRWAIT_100USDECABNETX_RF_SYNC_LRTS;*******************************************************************;*******************************************************************;endofrfproc;*******************************************************************;*******************************************************************;****************************************************************************************************************************************BEEP_1LDA#!100BEEP_2JSRSPKR_MUTE_OFF;JSRMUX_MCU_TO_SPBEEP_1_LBCLRBEEP_PIN_BIT,BEEP_PIN_PORTJSRWAIT_1MSBSETBEEP_PIN_BIT,BEEP_PIN_PORTJSRWAIT_1MSDECABNEBEEP_1_LJSRSPKR_MUTERTS*********************************************************************BEEP_INITBCLRBEEP_PIN_BIT,BEEP_PIN_PORTBSETBEEP_PIN_BIT,BEEP_PIN_DDR;OUTPUTRTS*********************************************************************OUTPUT_INIT;disabletheoutputdriver.BCLRMOTOR_1_BIT,MOTOR_1_PORTBCLRMOTOR_1_BIT,MOTOR_1_DDRRTS*********************************************************************SHUTT_ON;;settheshutt_offpinto″1″toallowpowertotherestofthecircuit.BSETPOWER_LOCK_BIT,POWER_LOCK_PORTBSETPOWER_LOCK_BIT,POWER_LOCK1_DDR;OUTPUTRTS*********************************************************************SHUTT_OFF;;settheshutt_offpinto″0″toshuttoffpowertotherestofthecircuit.;theMCUwillcontinuetoreceivepowerandshouldgotopowersavemode;utillreceiveanIRQorRESET.lda#0staportastaportbstaportcstaportdstaddrastaddrbstaddrcstaddrdBclrPOWER_LOCK_BIT,POWER_LOCK_PORTBSETPOWER_LOCK_BIT,POWER_LOCK_DDR;OUTPUTRTS********************************************************************;MATRIX_INIT;thereare5i/opinsthatallowtheMCUtodetectthestatusof;2X3sensormatrix.2ofthosei/opinsareusedasoutputs;and3asinputs.theMCUwillsacnthosepinstodetectwhichofthose;sensorsisinthe″0″status.;placethe2lineportsin″0″;BCLRMATRIX_LINE_1_BIT,MATRIX_LINE_1_PORT;BSETMATRIX_LINE_1_BIT,MATRIX_LINE_1_DDR;BCLRMATRIX_LINE_2_BIT,MATRIX_LINE_2_PORT;BSETMATRIX_LINE_2_BIT,MATRIX_LINE_2_DDR;RTS*********************************************************************;MUX_INIT;setthei/opintoOUTPUT.alsosettheMUXto;MCUtoSPEEKER;MICtoTRANSMITTER;MICtoA/D;BSETMUX_CNT_BIT,MUX_CNT_PORT;BSETMUX_CNT_BIT,MUX_CNT_DDR;RTS*********************************************************************SPKR_INITBSETMUTE_BIT,MUTE_DDR;OUTPUTBSETMUTE_BIT,MUTE_PORT;ANDMUTETHEESPKRTS**********************************************************************SPKR_MUTEBSETMUTE_BIT,MUTE_PORTRTS*********************************************************************SPKR_MUTE_OFFBCLRMUTE_BIT,MUTE_PORTRTS*********************************************************************;MUX_MCU_TO_SP;allowtheMCUtobeepthespeeker.theotherpositionofthemux;willconnecttheRFreceivertothespeaker.;sei;BSETMUX_CNT_BIT,MUX_CNT_PORT;RTS************************************************************;MUX_RX_TO_SP;connecttheRFreceivertothespeaker.;BCLRMUX_CNT_BIT,MUX_CNT_PORT;RTS*********************************************************************;MUX__TXRX_TO_MCU;connecttheMCUtothetransmittertoallowtheunittosendcontrol;messages.;BCLRMUX_CNT_BIT,MUXCNT_PORT;RTS*********************************************************************;MUX_TXRX_TO_MIC;connectthemicrophonetothetransmitter.;BSETMUX_CNT_BIT,MUX_CNT_PORT;bsetmux_cnt_bit,mux_cnt_port;;nop;RTS*******************************************************************************************************************************************RFPROC************************************************************************************************************************************************************************************************************************************************************************************WAIT_100US;;WAIT100USINCLUDINGTHEJSRCOMMAND;IFOSC=4MHZTHEN1US=2CYC;NEEDTOWAIT200CYC;JSR=5CYCSTAWAIT_REG1;2CYCLDA#!30;2CYC>30*6=180CYCWAIT_100US_LDECA;3CYC}3US=6CYCBNEWAIT_100US_L;3CYC}CLRA;3CYCNOP;2CYCLDAWAIT_REG1;2CYCRTS;6CYC;;--------------------;;5+2+2+180+3+2+2+6=200CYCWAIT_500USJSRWAIT_100USJSRWAIT_100USJSRWAIT_100USJSRWAIT_100USJSRWAIT_100USRTS*********************************************************************WAIT_1MS;;WAIT1MSEC(2000CYC)WITHTHEJSR;JSR=5CYCSTAWAIT_REG1;2CYCLDA#!248;2CYC>248*8=1984CYCWAIT_1MS_LDECA;3CYC}8CYCNOP;2CYC}BNEWAIT_1MS_L;3CYC}NOP;2CYCLDAWAIT_REG1;2CYCRTS;6CYC;;--------------------;;5+2+1984+2+2+6=2001CYC*********************************************************************WAIT_ACC_MS;;WAITACCX1MS;CLEARSTHEACCVALUEWHENEXITJSRWAIT_1MSDECABNEWAIT_ACC_MSRTS*********************************************************************WAIT_ACC_100MS;;WAITACCX100MS;CLEARSTHEACCVALUEWHENEXITSTAWAIT_REG2LDAWAIT_REG2BEQW_ACC_100MS_EXITWAIT_ACC_100MS_SLDA#!100WAIT_ACC_100MS_LJSRWAIT_1MSDECABNEWAIT_ACC_100MS_LBRSETCAR_DETECT_BIT,CAR_DETECT_PORT,w_acc_100ma_exit;NOCARRIERDECWAIT_REG2BNEWAIT_ACC_100MS_SW_ACC_100MS_EXITRTS*********************************************************************WAIT_acm_100ms;;WAITACCX100MS;CLEARSTHEACCVALUEWHENEXITSTAWAIT_REG2LDAWAIT_REG2BEQW_acm_100ms_EXITWAIT_acm_100ms_SLDA#!100WAIT_acm_100ms_LJSRWAIT_1MSDECABNEWAIT_acm_100mc_L;jsrchange_io2;changei/o#2from0>11>0DECWAIT_REG2BNEWAIT_acm_100ms_SW_acm_100ms_EXITRTS;XOL;-------------------------------------------------------------------;******PLLProqramingLibrary******;---------------------------------------------------------Sinclude″plllib.asm″;---------------------------------------------------------;*******DefaultPLLSettingsinROMDEF_SETdbREG1HIdbREG1LOdbREG2HIdbREG2LOdbREG3HIdbREG3LOdbREG4HIdbREG4LOdbREG5HIdbREG5LOdbREG6HIdbREG6LOdbREG7HIdbREG7LO;---------------------------------------------------------;ProcRegSetupSetCompanderregisterstodefault;InputNo;OutputNo;SpoildRegsA,X,Tmp1,Tmp2;---------------------------------------------------------RegSetupclrxSetupLoop;OutAddresstxalsraincajsrOutPLLAddr;OutDatastxTmp2;StoreXldaDEF_SET,X;LoadHiDefaultValuetoAldxDEF_SET+1,X;LoadLoDefaultValuetoXjsrOutPLLData;OutData;StoretoShadowldxTmp2;RestoreXldaDEF_SET,XstaPllShadow,X;StoreHibyteldaDEF_SET+1,XstaPllShadow+1,X;StoreLobyteincxincxcmpx#0EbneSetupLooprts;------------------------------------------------------------;ProcCompanderOffSetCompandertoInactiveMode;InputNo;OutputNo;SpoildRegsA,X,Tmp1;------------------------------------------------------------CompanderOfflda#04;DatatoRegister4jsrOutPLLAddrldaPll4Loora#%00011000;SetInactivModestaPll4Lotax;LowBytetoXldaPll4Hi;HiBytetoXjsrOutPLLData;OutDatarts;------------------------------------------------------------;ProcCompanderOnSetCompandertoActiveMode;InputNo;OutputNo;SpoildRegsA,X,Tmp1;------------------------------------------------------------CompanderOnlda#04;DatatoRegister4jsrOutPLLAddrldaPll4Loand#%11100111;SetActivModestaPll4Lotax;LowBytetoXldaPll4Hi;HiBytetoXjsrOutPLLData;OutDatarts;---------------------------------------------------------;ProcTalkOpenSetRx-On,Spk-On;InputNo;OutputNo;SpoildRegsA,X,Tmp1;---------------------------------------------------------TalkOpenlda#04hjsrOutPLLAddrldaPll4Loand#%11111100;SetRx-OnSpk-OnstaPll4Lotax;LoadLotoXldaPll4Hi;LoadHitoAjsrOutPLLDatarts;---------------------------------------------------------;ProcTalkCloseSetRx-Mute,Spk-Mute;InputNo;OutputNo;SpoildRegsA,X,Tmp1;---------------------------------------------------------TalkCloselda#04hjsrOutPLLAddrldaPll4Loora#%00000011;SetRx-MuteSpk-MutestaPll4Lotax;LoadLotoXldaPll4Hi;LoadHitoAjsrOutPLLDatarts;---------------------------------------------------------;ProcListenOpenSetTx-On;InputNo;OutputNo;SpoildRegsA,X,Tmp1;---------------------------------------------------------ListenOpenlda#04hjsrOutPLLAddrldaPll4Loand#%11111011;SetTx-OnstaPll4Lotax;LoadLotoXldaPll4Hi;LoadHitoAjsrOutPLLDataJSRTRANSMITTER_ONbsetTOIE,TCR;EnableTimerCounterbsetMIC_OPEN_FLAG,F(xiàn)LAGS1_BYTErts;---------------------------------------------------------;ProcListenCloseSetTx-Mute;InputNo;OutputNo;SpoildRegsA,X,Tmp1;---------------------------------------------------------ListenCloselda#04hjsrOutPLLAddrldaPll4Loora#%00000100;SetTx-MutestaPll4Lotax;LoadLotoXldaPll4Hi;LoadHitoAjsrOutPLLDataJSRTRANSMITTER_OFFbclrTOIE,TCR;EnableTimerCounterbclrMIC_OPEN_FLAG,F(xiàn)LAGS1_BYTErts;---------------------------------------------------------;Proccompander_cmdRead/WritetoCompanderDataRegister;Command=0101r/waddr;|+-----------3bitaddress;+---------------0-read1-write;InputNo;OutputNo;SpoildRegsA,X,Tmp1,Tmp2;---------------------------------------------------------compander_cmdldatxrx_rec_buff+1;A=commandbit#08h;CheckBitr/wbnewrite_compand;ReadandSendjsrSEND_ACK_COMPANDbracompand_exitwrite_compandjsrsend_ackldatxrx_rec_buff+1;A=commandand#07h;SelectAddresfromCommandstaTmp2;Tmp-RegisterAdddressjsrOutPLLAddr;StorenewDataToShadowMemoryldaTmp2decaaslatax;X-IndexofhadowMSBldatxrx_rec_buff+2;LoadMSBtoAfromcommandstaPllShadow,x;StoreHiBytetoshadowldatxrx_rec_buff+3;LoadLSBtoAfromcommandincxstaPllShadow,x;StoreLoBytetoshadow;OutDatatax;X=LSBldatxrx_rec_buff+2;A=MSBjsrOutPLLData;OutDatalda#70hjsrwait_acc_mscompand_exitrts;---------------------------------------------------------;ProcSendMSendbyteteoughtSPItoMoutionModule;InputA-BytetoSend;OutputNo;SpoildRegsA;---------------------------------------------------------SendMstaTmp3lda#66hstaSDR;SendSYNC;WaitxmitDoneWaitSIOP1brclrSPIF,SSR,WaitSIOP1ldaSDR;ClearSPIFldaTmp3staSDR;SendData;WaitxmitDoneWaitSIOP2brclrSPLF,SSR,WaitSIOP2ldaSDR;ClearSPIFrts*********************************************************************INTERRUPTVECTORS********************************************************************VECRESET;;THISISTHEPOWERONRESETROUTINE;;DISABLEALLINTERRUPTS;SEI;JMPSTART_OP;*************************************IRQ_PROC;;executedafteranirq\signal.;;jumphere16cycaftertheevent(hightolow).;themcualsosavesccr,acc,x,pch,pclregisters.RTI*************************************VECSWI;;THISISTHESWISOFTWAREINTERRUPTROUTINERTI*************************************VECSPI;;THISISTHEPERIPHEALINTERRUPTROUTINERTI*************************************VECSCI;;THISISTHESERIALINTERRUPTROUTINERTI;********************************************************************;ROMVARRIABLESMIDI_TEST_STRDBS12,S34,S56,S78,S9A;PR_ENDNOP*********************************************************************MASKOPTIONREGISTER********************************************************************;ORGS0900;705P9CHIP;db00ORGS1F00;705P6CHIPDB00;irq=negativeedge,nowdg,siopmsbfirst*********************************************************************STARTOFVECTOREPROM********************************************************************ORGS1FF8INT_VCTR;FDBTIMER_SYNCFDBIRQ_PROC;IRQ\CAUSETHEMIDIPROCESS.FDBVECSWIFDBSTART_OPENDCREAPI.DLL系列單端口PC軟件API模塊creapi.dll//creapi.c#define_CREAPI_DLL_#include″windows.h″#include″asrapi.h″#include″asr1500.h″#include″ttssdk32.h″#include″..\crpro\crpro.h″#include″creapi.h″#include″mmio.h″#include″notifvproc.h″#include″mess.h″#include″intdefs.h″#include″sr.h″#include″tts.h″#include″uniprt.h″#include″resource.h″#include″queue.h″#defineSRMESSAGESTRING″0555F940-BD0D-11d1-B001-00C0F01D50B7″voidInitialize();voidUninitialize();voidCALLBACKCrApiReadNotifyProc(PNOTIFY_PARAMSpNotifyParams);voidCALLBACKCrApiWriteNotifyProc(PNOTIFY_PARAMSpNotifyParams);HINSTANCEhInstance=NULL;HANDLEhWaitMessageEvent;BYTEWaitAckBuffer[MAX_MESSAGE_SIZE];CREAPINOTIFYPROCUserReadNotifyProc=NULL;CREAPINOTIFYPROCUserWriteNotifyProc=NULL;DWORDUserData;HQUEUEhReadNotifyQueue=NULL;HQUEUEhWriteNotifyQueue=NULL;HANDLEhReadNotifyThread;HANDLEhWriteNotifyThread;externUINTsrMessage;<prelisting-type="program-listing"xml:space="preserve"><![CDATA[//=================================LPSTRlpszCurrText;DWORDdwUnitTalkFlags;HWNDLEhUnitTalkThread;HANDLEhAsync;HANDLEhUnitTalkDone;DWORDdwQueueSize;HANDLEhUnitTalkBreak;HANDLEhQueueNotFull;HANDLEhUnitTalkBreakDone;externHTTSINSTANCEhTTSInst;//=====================================HANDLEhRecordFile=INVALID_HANDLE_VALUE;DWOROdwUnitRecordFlags;HANDLEhUnitRecordThread;BOOLbUnitRecord=FALSE;HANDLEhRecordAsync;DWORDdwTime;HANDLEhUnitRecordBreak;//================================BOOLWINAPIDllMain(HINSTANCEhinstDLL,DWORDfdwReason,LPVOIDlpvReserved){  switch(fdwReason){  case_DLL_PROCESS_ATTACH  if(hInstante?。絅ULL)  returnFALSE;  hInstance=hinstDLL;  Initialize();  break;  caseDLL_PROCESS_DETACH  Uninitialize();  break;  }  returnTRUE;//=================================DWORDWINAPIReadNotifyThread(PVOIDparam){  PCRAPI_NOTIFY_PARAMSpNotifyParams;  for(;;){  QueueWaitWhileEmpty(hReadNotifyQueue,INFINITE);pNotifyParams=(PCRAPI_NOTIFY_PARAMS)QueuePop(hReadNotifyQueue);switch(pNotifyParams->dwNotifyType){  caseCRPRO_READ_BUFFER_READY  pNotifyParams->dwNotifyType=CRAPI_BUFFER_RECEIVED;  break;  caseCRPRO_CNTR_RECEIVED  pNotifyParams->dwNotifyTpe=CRAPI_MESSAGE_RECEIVED;  break;  }  UserReadNotifyProc(pNotifyParams,UserData);  GlobalFree(pNotifyParams->pBuffer);  GlobalFree(pNotifyParams);  }  return0;}//=================================DWORDWINAPIWriteNotifyThread(PVOIDParam){  PCRAPI_NOTIFY_PARAMSpNotifyParams;  for(;;){  QueueWaitWhileEmpty(hWriteNotifyQueue,INFINITE);pNotifyParams=(PCRAPI_NOTIFY_PARAMS)QueuePop(hWriteNotifyQueue);  switch(pNotifyParams->dwNotifyTpe){  caseCRPRO_WRITE_BUFFER_BREAK  pNotifyParams->dwNotifyTpe=CRAPI_BREAK;  break;  caseCRPRO_WRITE_BUFFER_DONE  pNotifyParams->dwNotifyType=CRAPI_BUFFER_SENT;  break;  }  UserWriteNotifyProc(pNotifyParams,UserData);  GlobalFree(pNotifyParams);  }  return0;}//=================================CREAPISTATUScrSystemOpen(DWORDdwDeviceID,CREAPI_NOTIFY_PROCReadNotifyProc,CREAPI_NOTIFY_PROCWriteNotifyProc,DWORDdwUserData){  DWORDstatus;  DWORDdwDhreadID;status=proSystemOpen(dwDeviceID,CrApiReadNotifyProc,CrApiWriteNotifyProc);  if(status?。絊TATUS_OK)  returnstatus;  status=ttsOpen();  if(status!=STATUS_OK)(  proSystemClose();  returnstatus;  }  if(!srOpen()){  proSystemClose();  ttsClose();  returnCREAPI_STATUS_ERR_SROPEN;  }  if(ReadNotifyProc!=NULL){  hReadNotifyQueue=QueueCreate();  hReadNotifyThread=CreateThread(NULL,0,ReadNotifyThread,0,0,&amp;amp;dwThreadID);  UserReadNotifyProc=ReadNotifyProc;  }  if(WriteNotifyProc!=NULL){  hWriteNotifyQueue=QueueCreate();  hWriteNotifyThread=CreateThread(NULL,0,WriteNotifyThread,0,0,&amp;amp;dwThreadID);  UserWriteNotifyProc=WriteNotifyProc;  }  UserData=dwUserData;  returnSTATUS_OK;//=================================CREAPI_STATUScrSystemClose(){  DWORDstatus;  status=proSystemClose();srClose();  ttsClose();  if(UsecReadNotifyProc!=NULL){  while(QueueWaitWhileEmpty(hReadNotifyQueue,0)==WAIT_OBJECT_0);  QueueDestroy(hReadNotifyQueue);  TerminateThread(hReadNotifyThread,0);  WaitForSingleObject(hReadNotifyThread,INFINITE);  CloseHandle(hReadNotifyThread);  UserReadNotifyProc=NULL;  }  if(UserWriteNotifyProc!=NULL){  while(QueueWaitWhileEmpty(hWriteNotifyQueue,0)==WAIT_OBJECT_0);  QueueDestroy(hWriteNotifyQueue);  TerminateThread(hWriteNotifyThread,0);  WaitForSingleObject(hWriteNotifyThread,INFINITE);  CloseHandle(hWriteNotifyThread);  UserWriteNotifyProc=NULL;  }  returnstatus;}//=================================voidTestAckProc(PNOTIFY_PARAMSpNotifyParams){  if(WaitForSingleObject(hWaitMessageEvent,0)==WAIT_TIMEOUT){  PBYTEpBuffer=(PBYTE)pNotifyParams->pBuffer;  if(WaitAckBuffer==pBuffer){  mamcpy(WaitAckBuffer,pBuffer,pNotifyParams->dwBufferLength);  SetEvent(hWaitMessageEvent);  }  }}//=================================CREAPI_STATUScrSendBuffer(PVOIDpBuffer,DWORDdwBufferSize,DWORDdwUserData)(  returnproSendBuffer(pBuffer,dwBufferSize,dwUserData,0);}//=================================CREAPISTATUScrSendMessage(PVOIDpMessage,BYTEbyMessageType,BYTEbyMessageSize,PVOIDpAck,BYTEbypAckSize){  if(byMessageType&amp;amp;ACK_EXPECTED_MASK){  CRPRO_STATUSstatus;  DWORDtime_out=BASE_ACK_TIME_OUT;  time_out+=byMessageType&amp;amp;SRC_DEST_MASK?UNIT_ACK_TIMEOUT0;  WaitAckBuffer=byMessageType;  WaitAckBuffer&amp;amp;=~((BYTE)ACK_EXPECTED_MASK);  WaitAckBuffer|=DIRECTION_MASK;  ResetEvent(hWaitMessageEvent);  status=proSendMessage(pMessage,byMessageSize,byMessageType);  if(status?。絊TATUS_OK){  SetEvent(hWaitMessageEvent);  returnstatus;  }  if(WaitForSingleObject(hWaitMessageEvent,time_out)==WAIT_TIMEOUT){  SetEvent(hWaitMessageEvent);  returnCREAPI_STATUS_ERR_TIMEOUT;  }  if(pAck!=NULL)  memcpy(pAck,WaitAckBuffer,min(bypAckSize,WaitAckBuffer[1]+2));  returnSTATUS_OK;  }else  returnproSendMessage(pMessage,byMessageSize,byMessageType);}//==================================CREAPI_STATUScrBaseDetect(PBASE_DETECTpBaseDetect){CRPRO_STATUSstatus;  DWORDi; BYTEAck[MAX_MESSAGE_SIZE]; for(i=0;i<MAX_DEVICE_ID;i++)( status=proSystemOpen(i,CrApiReadNotifyProc,NULL); if(status==STATUS_OK){  if(crSendMessage(NULL,CMD_BASE_GET_VERSION,0,Ack,sizeof(Ack))==STATUS_OK){ proSystemClose();  pBaseDetect->dwDeviceID=i;pBaseDetect->version.byMajorVerNum=Ack[2]>>4;pBaseDetect->version.byMinorVerNum=Ack[2]&amp;amp;0x0F;  returnSTATUS_OK;  }  proSystemClose();  }  }  returnCREAPI_STATUS_ERR_BASENOTFOUND;}//==================================voidInitialize(){  hWaitMessageEvent=CreateEvent(NULL,TRUE,TRUE,NULL);  hUnitTalkDone=CreateEvent(NULL,TRUE,TRUE,NULL);  hUnitTalkBreak=CreateEvent(NULL,TRUE,F(xiàn)ALSE,NULL);  hQueueNotFull=CreateEvent(NULL,TRUE,TRUE,NULL);  hUnitTalkBreakDone=CreateEvent(NULL,TRUE,TRUE,NULL);  hUnitRecordBreak=CreateEvent(NULL,TRUE,TRUE,NULL);  srMessage=RegisterWindowMessage(SR_MESSAGE_STRING);}//==================================voidUninitialize(){  CloseHandle(hUnitTalkDone);  CloseHandle(hWaitMessageEvent);  CloseHandle(hQueueNotFull);  CloseHandle(hUnitTalkBreak);  CloseHandle(hUnitTalkBreakDone);CloseHandle(hUnitRecordBreak);  }  //==================================  CREAPI_STATUScrReset(DWORDdwFlags){  DWORDstatus;  status=proTransferReset(dwFlags);  if(UserReadNotifyProc)  while(QueueWaitWhileEmpty(hReadNotifyQueue,  0)==WAITOBJECT0);  if(UserWriteNotifyProc)  while(QueueWaitWhileEmpty(hWriteNotifyQueue,  0)==WAITOBJECT0);  returnstatus;  }  //==================================  CREAPI_STATUScrGetBaseVersion(PVERSIONbase_version){  DWORDstatus;  BYTEAck(MAXMESSAGE_SIZE);  status=crSendMessage(NULL,CMD_BASE_GET_VERSION,0,Ack,  sizeof(Ack));  if(status==STATUS_OK){  base_version->byMajorVerNum=Ack[2]>>4;  base_version->byMinorVerNum=Ack[2]&amp;amp;0x0F;  }  returnstatus;  }  //==================================  voidUnitTalkBufferDone(PNOTIFY_PARAMSpNotifyParams){  GlobalFree(pNotifyParams->pBuffer);  if(pNotifyParams->dwUserData==1)  SetEvent(hUnitTalkDone);  else{  dwQueueSize--;  if(dwQueueSize<UNIT_TALK_QUEUE_SIZE)  SetEvent(hQueueNotFull);  }  }//============================DWORDWINAPIUnitTalkThread(PVOIDParam){  DWORDret_value=STATUS_OK;  PVOIDpBuffer;  PVOIDpFinishMarker;  DWORDwait_result;  HANDLEhWaitEvents[2];  DWORDPCMDataSize,must_be_read,was_read;  intdone_status;  DWORDgen_size,taskno;  BOOLbTTSFirstBuffer;  hWaitEvents=hUnitTalkBreak;  hWaitEvents[1]=hQueueNotFull;  pFinishMarker=GlobalAlloc(GPTR,1);  *((PBYTE)(pFinishMarker))=0x80;  dwQueueSize=0;  ResetEvent(hUnitTalkDone);  SetEvent(hQueueNotFull);  if(dwUnitTalkFlags==UNITTALK_SRC_PCMFILE)  PCMDataSize=PCMGetDataSize();  else  bTTSFirstBuffer=TRUE;  for(;;){  wait_result=WaitForMultipleObjects(2,hWaitEvents,F(xiàn)AISE,INFINITE);  if(wait_result==WAIT_OBJECT_0){  proSendBuffer(pFinishMarker,1,1,UNIT_TALK_BUFFER);  SetEvent(hUnitTalkBreakDone);  break;  }  pBuffer=GlobalAlloc(GPTR,UNIT_TALK_BUFFER_SIZE);  if(pBuffer==NULL){  ret_value=CREAPI_STATUS_ERR_MALLOC;ProSendBuffer(pFinishMarker,1,1,UNIT_TALK_BUFFER);  break;  }  if(dwUnitTalkFlags==UNITTALK_SRC_PCMFILE)(  must_be_read=min(PCMDataSize,UNIT_TALK_BUFFER_SIZE);  if(!PCMReadFile(pBuffer,must_be_read,&amp;amp;was_read)){  GlobalFree(pBuffer);  ret_value=CREAPI_STATUS_ERR_PCMREAD;  proSendBuffer(pFinishMarker,1,1,UNIT_TALK_BUFFER);  break;  }  proSendBuffer(pBuffer,was_read,0,UNIT_TAKK_BUFFER);  PCMDataSize-=was_read;  dwQueueSize++;  if(dwQueueSize>=DNIT_TALK_QUEUE_SIZE)  ResetEvent(hQueueNotFull);  if(PCMataSize==0){//NormalDone  ret_value=STATUS_OK;  proSendBuffer(pFinishMarker,1,1,UNIT_TALK_BUFFER);  break;  }elseif(dwUnitTalkFlags==UNITTALK_SRC_TTS){  if(bTTSFirstBuffer)(  done_status=TtsGenPcmBuf(hTTSInst,lpszCurrText,strlen(lpszCurrText),  M_OUT_BLINEAR,M_ANSI_TEXT,UNIT_TALK_BUFFER_SIZE,pBuffer,&amp;amp;gen_size,&amp;amp;task_no);bTTSFirstBuffer=FALSE;  }else  done_status=TtsGenNextPcmBuf(hTTSInst,UNIT_TALK_BUFFER_SIZE,pBuffer,  M_OUT_BLINEAR,&amp;amp;gen_size,&amp;amp;task_no);  if(done_status==M_PCMGENDONE||done_status==E_NOINPUTTEXT){  GlobalFree(pBuffer);//NormalDone  ret_value=STATUS_OK;  proSendBuffer(pFinishMarker,1,1,UNIT_TALK_BUFFER);  break;  }  dwQueueSize++;  if(dwQueueSize>=UNIT_TALK_QUEUE_SIZE)  ResetEvent(hQueueNotFull);  proSendBuffer(pBuffer,gen_size,0,UNIT_TALK_BUFFER);  }  }  if(dwUnitTalkFlags==UNITTALK_SRC_PCMFILE)  PCMCloseFile();  elseif(dwUnitTalkFlags==UNITTALK_SRC_TTS){  TtsStopSpeech(hTTSInst,0);  GlobalFree(lpszCurrText);  }  WaitForSingleObject(hUnitTalkDone,INFINITE);  if(hAsync?。絅ULL){  SetEvent(hAsync);  CloseHandle(hUnitTalkThread);  hUnitTalkThread=NULL;  }returnret_value;}//======================================CREAPI_STATUScrUnitTalk(WORDwUnitNumber,DWORDdwFlags,LPCTSTRpszSource,HANDLEhOpAsync){  DWORDdwThreadID;  DWORDstatus;  if(hUnitTalkThread?。絅ULL&amp;amp;&amp;amp;pszSource==NULL){  ResetEvent(hUnitTalkBreakDone);  SetEvent(hUnitTalkBreak);  WaitForSingleObject(hUnitTalkBreakDone,INFINITE);  proTransferReset(BASEIO_WRITE_QUEUE);  WaitForSingleObject(hUnitTalkThread,INFINITE);  CloseHandle(hUnitTalkThread);  hUnitTalkThread=NULL;  returnSTATUS_OK;  }  if(dwFlags>0&amp;amp;&amp;amp;dwFlags<=UNITTALK_SRC_MAX_VALUE)  dwUnitTalkFlags=dwFlags;  else  returnCREAPI_STATUS_ERR_FLAG_NOTSUPP;  if(dwFlags==UNITTALK_SRC_PCMFILE){  if(!PCMInitFile(pszSource))  returnCREAPI_STATUS_ERR_PCMINIT;  }elseif(dwFlags==UNITTALK_SRC_TTS){  lpszCurrText=(LPSTR)GlobalAlloc(GPTR,strlen(pszSource)+1);  if(!lpszCurrText)  returnCREAPI_STATUS_ERR_MALLOC;  strcpy(lpszCurrText,pszSource);  }  status=crSendMessage(NULL,CMD_BASE_START_DA,0,NULL,0);  if(status?。絊TATUS_OK){  if(dwFlags==UNITTALK_SRC_PCMFILE)  PCMCloseFile();  elseif(dwFlags==UNITTALK_SRC_TTS)  GlobalFree(lpszCurrText);  returnstatus;  }hAsync=hOpAsync;  ResetEvent(hUnitTalkBreak);  if(hOpAsync!=NULL)  ResetEvent(hOpAsync);  hUnitTalkThread=CreateThread(NULL,0,UnitTalkThread,hOpAsync,0,&amp;amp;dwThreadID);  if(hAsync==NLLL){  WaitForSingleObject(hUnitTalkThread,INFINITE);  CloseHandle(hUnitTalkThread);  hUnitTalkThread=NULL;  }  returnSTATUS_OK;}//=================================voidUnitRecordBufferReady(PNOTIFY_PARAMSpNotifyParams){  DWORDwritten;  WriteFile(hRecordFile,pNotifyParams->pBuffer,pNotifyParams->dwBufferLength,&amp;amp;written,NULL);}//=================================DWORDWINAPIUnitRecordThread(PVOIDparam){  DWORDwait_result;  DWORDdata_size;  DWORDwritten;  bUnitRecord=TRUE;  crSendMessage(NULL,CMD_BASE_START_AD,0,NULL,0);  wait_result=WaitForSingleObject(hUnitRecordBreak,dwTime);  crSendMessage(NULL,CMD_BASE_BREAK,0,NULL,0);  crReset(BASEIO_READ_QUEUE);  bUnitRecord=FALSE;  if(dwUnitRecordFlags==UNITRECORD_DEST_PCMFILE){  data_size=SetFilePointer(hRecordFile,0,NULL,F(xiàn)ILE_CURRENT)-WAVE_HEADER_LENGTH;SetFilePointer(hRecordFile,WAVE_DATA_LEN_POS,NULL,F(xiàn)ILE_BEGIN);  WriteFile(hRecordFile,&amp;amp;data_size,sizeof(data_size),&amp;amp;written,NULL);  }  CloseHandle(hRecordFile);  hRecordFile=INVALID_HANDLE_VALUE;  if(hRecordAsync?。絅ULL){  SetEvent(hRecordAsync);  CloseHandle(hUnitRecordThread);  }  return0;}//=================================CREAPI_STATUScrUnitRecord(WORDwUnitNumber,DWORDdwTime_ms,DWORDdwFlags,LPCTSTRlpszDest,HANDLEhOpAsync){  HRSRChResInfo;  HGLOBALhResGlobal;  DWORDwritten;  DWORDdwThreadID;  if(dwFlags>0&amp;amp;&amp;amp;dwFlags<=UNITRECORD_MAX_VALUE)  dwUnitRecordFlags=dwFlags;  else  returnCREAPI_STATUS_ERR_FLAG_NOTSUPP;  if(hRecordFile?。絀NVALID_HANDLE_VALUE&amp;amp;&amp;amp;lpszDest==NULL){  SetEvent(hUnitRecordBreak);  WaitForSingleObject(hUnitRecordThread,INFINITE);  returnSTATUS_OK;  }  hRecordFile=CreateFile(lpszDest,GENERIC_WRITE,0,NULL,CREATE_ALWAYS,F(xiàn)ILE_ATTRIBUTE_NORMAL,NULL);  if(hRecordFile==INVALID_HANDLE_VALUE)  returnCREAPI_STATUS_ERR_FILE_CREATE;  if(dwFlags==UNITRECORD_DEST_PCMFILE){hResInfo=FindResource(hInstance,″IDR_8BIT8KHZ_HEADER″,″WAVEHFADER″);  hResGlobal=LoadResource(hInstance,hResInfo);  WriteFile(hRecordFile,hResGlobal,WAVE_HEADER_LENGTH,&amp;amp;written,NULL);  if(written?。絎AVE_HEADER_LENGTH){  CloseHandle(hRecotdFile);  hRecordFile=INVALID_HANDLE_VALUE;  returnCREAPI_STATUS_ERR_FILE_WRITE;  }  }  hRecordAsync=hOpAsync;  dwTime=dwTime_ms;  ResetEvent(hUnitRecordBreak);  if(hOpAsync?。絅ULL)  ResetEvent(hOpAsync);  hUnitRecordThread=CreateThread(NULL,0,UnitRecordThread,hOpAsync,0,&amp;amp;dwThreadID);  if(hOpAsync==NULL){  WaitForSingleObject(hUnitRecordThread,INFINITE);  CloseHandle(hUnitRecordThread);  }  returnSTATUS_OK;}//=================================#ifndef_INTDEFS_H_#define_INTDEFS_H_#defineCRAPI_INTERNAL_USE2#defineEVENT_SENSOR1#defineEVENT_SR2#defineWE_SR_RESULT1#defineWE_SENSOR_RESULT2#defineSTRING_MAX_LENGTH80#defineMAX_MESSAGE_SIZE255typedefstruct__SR_BUFFER{  pvoIDpBuffer;  DWORDdwBufferSize;}SR_BUFFER,*PSR_BUFFER;#defineCMDWAITFOREVENT1#defineCMD_UNITRECORD2#defineWAVE_HEADER_LENGTH44#defineWAVE_DATA_LEN_POS40#defineMAX_DEVICE_ID10#defineUNIT_TALK_BUFFER_SIZE2048#defineUNIT_TALK_QUEU11E_SIZE10#defineUNIT_TALK_BUFFER0x00000100#endif//_INTDEFS_H_#include<windows.h>#include<mmsystem.h>#include″mmio.h″DWORDpcm_data_size;HMMIOhmmio;BOOLPCMInitFile(LPCTSTRpszFileName){  MMCKINFOmmckinfoParent;  MMCKINFOmmckinfoSubchunk;  DWORDdwFmtSize;  HGLOBALhFormat;  WAVEFORMATEX*pFormat;  hmmio=mmioOpen((LPSTR)pszFileName,NULL,MMIO_READ|MMIO_ALLOCBUF);  if(!hmmio)  returnFALSE;  mmckinfoParent.fccType=mmioFOURCC(′W′,′A′,′V′,′E′);  if(mmioDescend(hmmio,&amp;amp;mmckinfoParent,NULL,MMIO_FINDRIFF)){  mmioClose(hmmio,0);  returnFALSE;  }  mmckinfoSubchunk.ckid=mmioFOURCC(′f′,′m′,′t′,′′);  if(mmioDescend(hmmio,&amp;amp;mmckinfoSubchunk,&amp;amp;mmckinfoParent,MMIO_FINDCHUNK)){  mmioClose(hmmio,0);  returnFALSE;  }  dwFmtSize=mmckinfoSubchunk.cksize;  hFormat=GlobalAlloc(LMEM_MOVEABLE,LOWORD(dwFmtSize));  if(!hFormat){  mmioClose(hmmio,0);  returnFALSE;  }  pFormat=(WAVEFORMATEX*)GlobalLock(hFormat);  if(!pFormat){  GlobalFree(hFormat);  mmioClose(hmmio,0);  returnFALSE;  }  if(mmioRead(hmmio,(HPSTR)pFormat,dwFmtSize)!=(LONG)dwFmtSize){  GlobalUnlock(hFormat);GlobalFree(hFormat);  mmioClose(hmmio,0);  returnFALSE;  if(pFormat->wFormatTag?。絎AVE_FORMAT_PCM){  GlobalUnlock(hFormat);  GlobalFree(hFormat);  mmioClose(hmmio,0);  returnFALSE;  }  GlobalUnlock(hFormat);  GlobalFree(hFormat};  mmioAscend(hmmio,&amp;amp;mmckinfoSubchunk,0);  mmckinfoSubchunk.ckid=mmioFOURCC(′d′,′a′,′t′,′a′);  if(mmioDescend(hmmio,&amp;amp;mmckinfoSubchunk,&amp;amp;mmckinfoParent,MMIO_FINDCHUNK)){  mmioClose(hmmio,0);  returnFALSE;  }  pcm_data_size=mmckinfoSubchunk.cksize;  if(pcm_data_size==0L){  mmioClose(hmmio,0);  returnFALSE;  }  returnTRUE;}BOOLPCMReadFile(PVOIDpBuffer,DWORDbytes_to_read,PDWORDwas_read){  LONGactually_read;  actually_read=mmioRead(hmmio,pBuffer,bytes_to_read);  if(actually_read==-1}  returnFALSE;  *was_read=actually_read;DWORDPCMGetDataSize(){  returnpcm_data_size;}BOOLPCMCloseFile(){  mmioClose(hmmio,0);  returnTRUE;}#include″asrapi.h″#include″asr1500.h″#include″notifyproc.h″#include″..\crpro\crpro.h″#include″creapi.h″#include″mess.h″#include″intdefs.h″#include″uniprt.h″#include″queue.h″externcREAPI_NOTIFY_PROCUserReadNotifyProc;externCREAPI_NOTIFY_PROCUserWriteNotifyProc;voidTestAckProc(PNOTIFY_PARAMSpNotifyParams);externHQUEUEhReadNotifyQueue;externHQUEUEhWriteNotifyQueue;voidDoReadNotify(PNOTIFY_PARAMSpNotifyParams);voidDoWriteNotify(PNOTIFY_PARAMSpNotifyParams);voidUnitTalkBufferDone(PNOTIFY_PARAMSpNotifyParams);externBOOLbUnitRecord;voidUnitRecordBufferReady(PNOTIFY_PARAMSpNotifyParams);externBOOLbWaitForEvent;voidWaitForEventBufferReady(PNOTIFY_PARAMSpNotifyParams);externHANDLEhEventEvent;//=======================================================voidCALLBACKCrApiReadNotifyProc(PNOTIFY_PARAMSpNotifyParams){  BOOLCallUserCallback=TRUE;  switch(pNotifyParams->dwNotifyType){  caseCRPRO_CNTR_RECEIVED  TestAckProc(pNotifyParams);  break;  caseCRPRO_READ_BUFFER_READY  if(bUnitRecord){  UnitRecordBufferReady(pNotifyParams);  CallUserCallback=FALSE;  }if(WaitForSingleObject(hEventEvent,0)==WAIT_TIMEOUT){  WaitForEventBufferReady(pNotifyParams);  CallUserCallback=FALSE;  }  break;  }  if(UserReadNotifyProc!=NULL&amp;amp;&amp;amp;CallUserCallback)  DoReadNotify(pNotifyParams);}//================================================================voidCALLBACKCrApiWriteNotifyProc(PNOTIFY_PARAMSpNotifyParams){  if(pNotifyParams->dwFlags==UNIT_TALK_BUFFER){  UnitTalkBufferDone(pNotifyParams);  return;  }  switch(pNotifyParams->dwNotifyType){  caseCRPRO_WRITE_BUFFER_DONE  break;  caseCRPRO_WRITE_BUFFER_BREAK  break;  }  if(UserWriteNotifyProc!=NULL)  DoWriteNotify(pNotifyParams);}//===================================voidDoReadNotify(PNOTIFY_PARAMSpNotifyParams){  PNOTIF_PARAMSpPushParams;  pPushParams=(PNOTIFY_PARAMS)GlobalAlloc(GPTR,sizeof(NOTIFY_PARAMS));  memcpy(pPushParams,pNotifyParams,sizeof(NOTIFYPARAMS));  pPushParams->pBuffer=GlobalAlloc(GPTR,pNotifyParams->dwBufferLength);  memcpy(pPushParams->pBuffer,pNotifyParams->pBuffer,pNotifyParams->dwBufferLength);  QueuePush(hReadNotifyQueue,pPushParams);}//===============================================================voidDoWriteNotify(PNOTIFY_PARAMSpNotifyParams){  PNOTIFY_PARAMSpPushParams;  pPushParams=(PNOTIFY_PARAMS)GlobalAlloc(GPTR,sizeof(NOTIFY_PARAMS));  memcpy(pPushParams,pNotifyParams,sizeof(NOTIFY_PARAMS));  QueuePush(hWriteNotifyQueue,pPushParams);}//===================================#ifndef_NOTIFYPROC_H_#define_NOTIFYPROC_H_#include<windows.h>#include<mmsysytem.h>typedefstruct_LOCAL_NOTIFY_PMRAMS{  BOOLlast_buffer;  HANDLEhAsyncEvent;  HANDLEhSyncEvent;  HANDLEhThread;  PBOOLpbUnitTalkProcess;}LOCAL_NOTIFY_PARAMS,*PLOCAL_NOTIFYPARAMS;voidSetWaitMessage(PVOIDpWaitMessage,BYTEbyWaitMessageSize,BYTEbyWaitMessageType);#endif//NOTIFYPROC_H_#define_CREAPI_DLL_#include<windows.h>#include<mmsystem.h>#include"resource.h"#include"asrapi.h"#include"asrLS00.h"#include"strsupp.h"#include"creapi.h"#include"mess.h"#include"intdefs.h"#include"uniprt.h"#include"sr.h"#include"..\crpro\crpro.h"#defineCTX_CLOSE#defineCTX_WRITE_MODE2#defineCTX_READ_MODK3externHINSTARCEhInstance;HDBhDb;HASRhAsr;HCTXhCtx;WORDwCtxMode=CTX_CLOSE;charactire_context[80];DWORDuserThrmadID;HANDLEhWEThread;DWORDdwWZResult;WORDConfLevelFilter=0;NOTIFY_RESULT_SIMPLE*las=_sr_resul=NULL;DWORDCALLBACKNo=ifyProc(HNOTIFYhNo=ify,NOTIFY_TYPENo=ifyTy~e,HASRhAsr,DWORDUserData);voidCALLBACKErrorProc(HASRhAsr,WORDBlockID,ASRERRORErrorID);voidCALLBACKstateChangeProc(HASRhAmr,ASRSTATEAsrState,ASRMODEAsrModeJ;DWORDSetActiveConteXt(char'con=ext,WORDmode);CREAPISTATUScrsrSelectContext(LPSTRcontext);DWORDSRThreadID;HANDLEhSRThread;HANDLEhEventEvent;UINTsrMessage;BOOLsrOpen(){  ASRERRORstatus;  chardatabase[80];  if(!LoadString(hInstance,IDSDATABASE,database,sizeof(database)))  returnFALSE;  hDb=asrDbOpen(database);  if(hDb<ASRERR_MAXERR)  returnFALSE;  hAsr=asrRecOpenEx(hDb,″Win32″,NULL,ErrorProc,StateChangeProc,NotifyProc,0);  if(hAsr<ASRERR_MAXERR){  asrDbClose(hDb);  returnFALSE;  }  status=asrRecSetMode(hAsr,ASRMODECONTINUOUS);  if(status?。紸SRERROK){  asrRecClose(hAsr);  asrDbClose(hDb);  returnFALSE;  }hEventEvent=CreateEvent(NULL,TRUE,TRUE,NULL);  returnTRUE;}//==================================DWORDsrStart(){  DWORDstatus;  WAVEFORMATwf=(WAVE_FORMAT_PCM,1,8000,8000,1);  if(wCtxMode==CTX_CLOSE)  returnCREAPI_STATUS_ERR_CNTX_INACTIVE;  status=asrRecAcqOpen(hAsr,&amp;amp;wf);  if(status?。紸SRERR_OK)  returnstatus+SR_MIN_ERR_VALUE;  status=asrRecStart(hAsr,NULL,NULL);  if(status?。紸SRERR_OK){  asrRecAcqClose(hAsr);  returnstatus+SR_MIN_ERR_VALUE;  }  returnSTATUS_OK;//==================================DWORDsrStop(){  DWORDstatus;  status=asrRecBreak(hAsr);  if(status!=ASRERR_OK)  returnstatus+SR_MIN_ERR_VALUE;  status=asrRecAcqClose(hAsr);  if(status?。紸SRERR_OK)  returnstatus+SR_MIN_ERR_VALUE;  returnSTATUS_OK;}//==================================BOOLsrClose(){  SetActiveContext(active_context,CTX_CLOSE);  asrRecClose(hAsr);  asrDbClose(hDb);if(last_sr_result)  GlobalFree(last_sr_result;  CloseHandle(hEventEvent);  returnTRUE;//==================================CREAPI_STATUScrSrCreateContext(LPSTRcontext){  ASRERRORasr_status;  charuser[80];  charsyntax[80];  charlanguage[80];  charupper_context[80];  if(*context==0)  returnCREAPI_STATUS_ERR_CONTEXTNAME;  if(!LoadString(hInstance,IDS_USER,user,sizeof(user)))  returnCREAPI_STATUS_ERR_LOADSTRING;  if(!LoadString(hInstance,IDS_LANGUAGE,language,sizeof(language)))  returnCREAPI_STATUS_ERR_LOADSTRING;  if(!LoadString(hInstance,IDS_SYNTAX,syntax,sizeof(syntax)))  returnCREAPI_STATUS_ERR_LOADSTRING;  strcpy(upper_context,context);  str_to_upper(upper_context);  asr_status=asrCtxCreate(hDb,user,language,syntax,upper_context);  returnasr_status==ASRERR_OK?STATUS_OKasr_status+SR_MIN_ERR_VALUE;//==================================CREAPI_STATUScrSrDeleteContext(LPSTRcontext){  ASRERRORasr_status;  charuser[80];  charupper_context[80];  strcpy(upper_context,context);  str_to_upper(upper_context);  if(!LoadString(hInstance,IDS_USER,user,sizeof(user)))  returnCREAPI_STATUS_ERR_LOADSTRING;asr_status=asrCtxDelete(hDb,user,upper_context);  returnasr_status==ASRERR_OK?STATUS_OKasr_status+SR_MIN_ERR_VALUE;//===================================CREAPI_STATUScrSrGetContexts(LPSTRbuffer,PDWORDdwBufferSize  ASERRORasr_status;  DWORDdwSize;  DWORDi;  charuser[80];  if(!LoadString(hInstance,ID1S_USER,user,sizeof(user)))  returnCREAPI_STATUS_ERR_LOADSTRING;  asr_status=asrUsrGetInfo(hDb,user,ASRUSRINFO_CONTEXTS,NULL,&amp;amp;dwSize);  if(asr_status!=ASRERR_OK)  returnasr_status+SR_MIN_ERR__VALUE;  if(buffer==UNLL){  *dwBufferSize=dwSize;  returnSTATUS_OK;  if(*dwBufferSize<dwSize)  returnCREAPISTATUS_ERR_BUFFER_TOO_SMALL;  asr_status=asrUsrGetInfo(hDb,user,ASRUSRINFO_CONTEXTS,buffer,dwBufferSize);  if(asr_status?。紸SRERR_OK)  returnasr_status+SR_MIN_ERR_VALUE;  for(i=0;i<dwSize-1;i++){  if(buffer[i]==0){  if(buffer[i+1]==0)  break;  buffer[i]=′,′;  }  }  returnSTATUSOK;//===================================DWORDSetActiveContext(char*context,WORDmode){  DWORDstatus=STATUS_OK;charuser[80];  if(strcmp(context,active_context)?。?||mode?。絯CtxMode)(  if(wCtxMode?。紺TX_CLOSE){  if(wCtxMode==CTX_READ_MODE){  status=asrRecCtxActivateEx(hAsr,(ASRACTIVATE*)NULL,0,(HLIB)NULL);  if(status?。紸SRERR_OK)  returnstatus+SR_MIN_ERR_VALUE;  }  status=asrCtxClose(hCtx,TRUE);  if(status?。紸SRERR_OK)  returnstatus+SR_MIN_ERR_VaLUE;  }  if(mode?。紺TX_CLOSE){  if(!LoadString(hInstance,IDS_USER,user,sizeof(user)))  returnCREAPI_STATUS_ERR_LOADSTRING;  if(mode==CTX_READ_MODE)  hCtx=asrCtxOpen(hDb,user,context,ASRCTXATTRIB_READ);  else  hCtx=asrCtxOpen(hDb,user,context,ASRCTXATTRIB_WRITE);  if(hCtx>ASRERR_MAXERR){  if(mode==CTX_READ_MODE){  ASRACTIVATEAsrActivate;  AsrActivate.hCtx=hCtx;  *AsrActivate.szSymbol=′\0′;  status=asrRecCtxActivateEx(hAsr,&amp;amp;AsrActivate,1,(HLIB)NUL);  if(status?。紸SRERR_OK){  asrCtxClose(hCtx,F(xiàn)ALSE);  returnstatus+SR_MIN_ERR_VALUE;  }  }  strcpy(active_context,context);  wCtxMode=mode;  }  }  }  returnstatus;}//=====================================================CREAPI_STATUScrSrSelectContext(LPSTRcontext){  charuser[80];  DWORDdwSize;  char*pBuffer;  char*pUpperContext;  DWORDstatus;  if(context==NULL)  returnSetActiveContext(active_context,CTX_CLOSE);  if(!LoadString(hInstance,IDS_USER,user,sizeof(user)))  returnCREAPI_STATUS_ERR_LOADSTRING;  status=asrUsrGetInfo(hDb,user,ASRUSRINFO_CONTEXTS,NULL,&amp;amp;dwSize);  if(status?。紸SRERR_OK)  returnstatus+SR_MIN_ERR_VALUE;  pBuffer=(char*)GlobalAlloc(GPTR,dwSize);  if(!pBuffer)  returnCREAPI_STATUS_ERR_MALLOC;  status=asrUsrGetInfo(hDb,user,ASRUSRINFO_CONTEXTS,pBuffer,&amp;amp;dwSize);  if(status?。紸SRERR_OK){  GlobalFree(pBuffer);  returnstatus+SR_MIN_ERR_VALUE;  }  pUpperContext=GlobalAlloc(GPTR,strlen(context)+1);  if(!pUpperContext){  GlobalFree(pBuffer);  returnCREAPI_STATUS_ERR_MALLOC;  }  strcpy(pUpperContext,context);  str_to_upper(pUpperContext);  if(!szszz(pUpperContext,pBuffer)){  GlobalFree(pBuffer);  GlobalFree(pUpperContext);  returnCREAPI_STATUS_ERR_CNTX_NOT_FOUND;  }  GlobalFree(pBuffer);  status=SetActiveContext(pUpperContext,CTX_READ_MODE);GlobalFree(pUoperContext);  returnstatus;//===================================CREAPI_STATUScrSrGetWords(LPSTRbuffer,PDWORDpdwBufferSize){  ASRERRORstatus;  DWORDdwSize,i;  if(wCtxMode==CTX_CLOSE)  returnCREAPI_STATUS_ERR_CNTX_INACTIVE;  status=asrCtxGetWords(hCtx,ASRCTXGETWORDS_ALLWORDS,″Word″,NULL,&amp;amp;dwSize);  if(status?。紸SRERR_OK)  returnstatus+SR_MIN_ERR_VALUE;  if(buffer=NULL){  *pdwBufferSize=dwSize;  returnSTArS_OK;  }  if(*pdwBufferSize<dwSize)  reeturnCREAPI_STATUS_ERR_BUFFER_TOO_SMALL;  status=asrCtxGetWords(hCtx,ASRCTXGETWORDS_ALLWORDS,″Word″,buffer,&amp;amp;dwSize);  if(status?。紸SRERR_OK)  returnstatus+SR_MIN_ERR_VALUE;  for(i=0;i<dwSize-1;i++){  if(buffer[i]==0){  if(buffer[i+1]==0)  break;  buffer[i]=′,′;  }  returnSTATUS_OK;//====================================CREAPI_STATUScrSrAddWords(LPSTRlist_of_words){charseps[]=″,\n″;  char*token;  char*pSource;  char*pWord;  char*pWordsInDB;  ASRERRORstatus;  DWORDdwSize;  if(wCtxMode==CTX_CLOSE)  returnCREAPI_STATUS_ERR_CNTX_INACTIVE;  status=asrCtxGetWords(hCtx,ASRCTXGETWORDS_ALLWORDS,″Word″,NULL,&amp;amp;dwSize);  if(status!=ASRERR_OK)  returnstatus+SR_MIN_ERR_VALUE;  pWordsInDB=GlobalAlloc(GPTR,dwSize);  if(!pWordsInDB)  returnCREAPI_STATUS_ERR_MALLOC;  status=asrCtxGetWords(hCtx,ASRCTXGETWORDS_ALLWORDS,″Word″,pWordsInDB,&amp;amp;dwSize);  if(status!=ASRERR_OK){  GlobalFree(pWordsInDB);  returnstatus+SR_MIN_ERR_VALUE;  }  pSource=GlobalAlloc(GPTR,strlen(list_of_words)+1);  if(!pSource){  GlobalFree(pWordsInDB);  returnCREAPI_STATUS_ERR_MALLOC;  }  strcpy(pSource,list_of_words);  token=strtok(pSource,seps);  while(token!=NULL){  pWord=GlobalAlloc(GPTR,strlen(token)+1);  if(!pWord){  GlobalFree(pSource);  GlobalFree(pWordsInDB);  returnCREAPI_STATUS_ERR_MALLOC;  }  strcpy(pWord,token);  pWord=str_alltrim(pWord);  str_to_upper(pWord);  if{!szszz(pWord,pWordsInDB)){status=SetActiveContext(active_context,CTX_WRITE_MODE);  if(status?。絊TATUS_OK){  GlobalFree(pWord);  GlobalFree(pSource);  GlobalFree(pWordsInDB);  SetActiveContext(active_context,CTX_READ_MODE);  returnstatus;  }  status=asrCtxAddWord(hCtx,(HDICT)NULL,″Word″,pWord);  if(status?。紸SRERR_OK){  GlobalFree(pWord);  GlobalFree(pSource);  GlobalFree(pWordsInDB);  SetActiveContext(active_context,CTX_READ_MODE);  returnstatus+SR_MIN_ERR_VALUE;  }  }  GlobalFree(pWord);  token=strtok(NULL,seps);  }  GlobalFree(pSource);  GlobalFree(pWordsInDB);  status=SetActiveContext(active_context,CTX_READ_MODE);  returnstatus;}//=======================================CREAPI_STATUScrSrRemoveWords(LPSTRlist_of_words){  charseps[]=″,\n″;  char*token;  char*pSource;  char*pWord;  char*pWordsInDB;  ASRERRORstatus;  DWORDdwSize;  status=asrCtxGetWords(hCtx,ASRCTXGETWORDS_ALLWORDS,″Word″,NULL,&amp;amp;dwSize);if(status?。紸SRERR_OK)  returnstatus+SR_MIN_ERR_VALUE;  pWordsInDB=GlobalAlloc(GPTR,dwSize);  if(!pWordsInDB)  returnCREAPI_STATUS_ERR_MALLOC;  status=asrCtxGetWords(hCtx,ASRCTXGETWORDS_ALLWORDS,″Word″,pWordsInDB,&amp;amp;dwSize);  if(status?。紸SRERR_OK){  GlobalFree(pWordsInDB);  returnstatus+SR_MIN_ERR_VALUE;  }  pSource=GlobalAlloc(GPTR,strlen(list_of_words)+1);  if(!pSource){  GlobalFree(pWordsInDB);  returnCREAPI_STATUS_ERR_MALLOC;  }  strcpy(pSource,list_of_words);  token=strtok(pSource,seps);  while(token?。絅ULL){  pWord=GlobalAlloc(GPTR,strlen(token)+1);  if(!pWord){  GlobalFree(pSource);  GlobalFree(pWordsInDB);  returnCREAPI_STATUS_ERR_MALLOC;  }  strcpy(pWord,token);  pWord=str_alltrim(pWord);  str_to_upper(pWord);  if(szszz(pWord,pWordsInDB)){  status=SetActiveContext(active_context,CTX_WRITE_MODE);  if(status?。絊TATUS_OK){  GlobalFree(pWord);  GlobalFree(pSource);  GlobalFree(pWordsInDB);  SetActiveContext(active_context,CTX_READ_MODE);  returnstatus;  }  status=asrCtxDeleteWord(hCtx,″Word″,pWord);  if(status?。紸SRERR_OK){  GlobalFree(pWord);GlobalFree(pSource);  GlobalFree(pWordsInDB);  SetActiveContext(active_context,CTX_READ_MODE);  returnstatus+SR_NIN_ERR_VALUE;  }  }  GlobalFree(pWord);  token=strtok(NULL,seps);  GlobalFree(pSource);  GlobalFree(pWordsInDB);  status=SetActiveContext(active_context,CTX_READ_MODE);  returnstatrs;//====================================DWORDCALLBACKNotifyProc(HNOTIFYhNotify,NOTIFY_TYPENotifyType,HASRhAsr,DWORDUserData)(  ASRERRORerr;  NOTIFY_RESULT_NnN;  NOTIFY_FORMAT_SIMPLEnFormat;  DWORDsize=sizeof(NOTIFY_RESULT_N);  switch(NotifyType.wNotifyType){  caseNOTIFY_TYPE_RESULT  asrNotifyQuery(hNotify,NRESULT_N,NULL,0,&amp;amp;nN,&amp;amp;size);  nFormat.wN=0;  nFormat.wActions=FORMAT_SIMPLE_ALL;  nFormat.bNoReject=FALSE;  err=asrNotifyQuery(hNotify,  NRESULT_SIMPLE,  &amp;amp;nFormat,sizeof(NOTIFY_FORMAT_SIMPLE),  NULL,  &amp;amp;size);  if(last_sr_result)  GlobalFree(last_sr_result);  last_sr_result=(NOTIFY_RESULT_SIMPLE*)GlobalAlloc(GPTR,size);if(!last_sr_result)(asrNotifyRelease(hNotify);returnASRERR_OK;}err=asrNotifyQuery(hNotify,NRESULT_SIMPLE,&amp;amp;nFormat,sizeof(NOTIFY_FORMAT_SIMPLE),Last_sr_result,&amp;amp;size);if(Last_sr_result->wConfidence>=ConfLevelFilter)(dwWEResult=WE_SR_RESULT;SetEvent(hEventEvent);}}asrNotifyRelease(hNotify);returnASRERR_OK;}//=================================voidCALLBACKErrorProc(HASRhAsr,WORDBlockID,ASRERRORErrorID)()//=================================voidCALLBACKStateChangeProc(HASRhAsr,ASRSTATEAsrState,ASRMODEAsrMode}{}//=================================CREAPI_STATUScrSrGetResult(LPSTRpBuffer,PDWORDpdwBufferSize)(if(last_sr_result==NULL)returnCREAPI_STATUS_ERR_RESULT_NOT_EXIST;if(pBuffer==NULL){*pdwBufferSize-strlen(last_sr_result->szResult)+l;returnSTATUS_OK;}if((*pdwBufferSize)<(strlen(last_sr_result->szResult)+l))returnCREAPI_STATUS_ERR_BUFFER_TOO_SMAlL;strcpy(pBuffer,last_sr_result->szResult);  returnSTATUS_OK;}//=================================CREAPI_STATUScrSrGetConfLevel(PWORDpwConfLevel){  if(last_sr_result==NULL)  returnCREAPI_STATUS_ERR_RESULT_NOT_EXIST;  *pwConfLevel=last_sr_result->wConfidence;//======================================CROPI_STATUScrSrSetConfLevelFilter(WORDwConfLevelFilter){  ConfLevelFilter=wConfLevelFilter;  returnSTATUS_OK;}//======================================CREAPI_STATUScrSrGetParam(WORDwParamType,PWORDpwValue){  ASRERRORstatus;  DWORDdwSize;  dwSize=sizeof(WORD);  status=asrRecGetParam(hAsr,wParamType,pwValue,&amp;amp;dwSize);  if(status?。紸SRERR_OK)  returnstatus+SR_MIN_ERR_VALUE;  returnSTATUS_OK;}//======================================CREAPI_STATUScrSrSetParam(WORDwParamType,WORDwNewValue){  ASRERRORstatus;  DWORDdwSize;  dwSize=sizeof(WORD);  status=asrRecSetParam(hAsr,wParamType,&amp;amp;wNewValue,dwSize);  if(status?。紸SRERR_OK)  returnstatus+SR_MIN_ERR_VALUE;  returnSTATUS_OK;}//========================================================voidWaitForEventBufferReady(PNOTIFY_PARAMSpNotifyParams){  ASRERRORstatus;  status=asrRecAcqWaveBuffer(hAsr,pNotifyParams->pBuffer,pNotifyParams->dwBufferLength);  if(status?。?)  MessageBox(0,″asrRecAcqWaveBuffer″,″Error″,MB_OK);//========================================================DWORDWINAPIWEThread(PVOIDparam){  UINTtime_to_wait=(UINT)param;  DWORDret_value;  if(WaitForSingleObject(hEventEvent,time_to_wait)==WAIT_TIMEOUT)  ret_value=WE_TIMEOUT;  else  ret_value=dwWEResult;  PlstThreadMessage(userThreadID,srMessage,ret_value,0);  return0;//========================================================CREAPI_STATUScrWaitForEvent(WORDwUnitNumber,LPSTRpszWordMap,  DWORD_dwFlags,DWORDtime_ms,PWORDpwResult){  char*pMap;  ASRERRORstatus;  char*pWordsInDB;  DWORDdwSize;  charseps[]=″,\n″;  char*token;  char*pszWord;  char*pActiveWordsBuffer;  char*curr_actbuf_ptr;  char*p;  char*pszRetVal;  DWORDdwWaitRetValue;  DWORDcrapi_status;  MSGMsg;  DWORDdwThreadID;  if(wctxMode==CTX_CLOSE)returnCREAPI_STATUS_ERR_CNTX_INACTIVE;  dwWEResult=0;  status=asrCtxGetWords(hCtx,ASRCTXGETWORDS_ALLWORDS,″Word″,NULL,&amp;amp;dwSize);  if(status?。紸SRERR_OK)  returnstatus+SR_MIN_ERR_VALUE;  pWordsInDB=malloc(dwSize);  if(!pWordsInDB)  returnCREAPI_STATUS_ERR_MALLOC;  status=asrCtxGetWords(hCtx,ASRCTXGETWORDS_ALLWORDS,″Word″,pWordsInDB,&amp;amp;dwSize);  if(status!=ASRERR_OK){  free(pWordsInDB);  returnstatus+SR_MIN_ERR_VALUE;  }  pMap=GlobalAlloc(GPTR,strlen(pszWordMap)+l);  if(!pMap){  free(pWordsInDB);  returnCREAPI_STATUS_ERR_MALLOC;  }  strcpy(pMap,pszWordMap);  pActiveWordsBuffer=malloc(strlen(pMap)+1);  if(!pActiveWordsBuffer){  GlobalFree(pMap);  free(pWordsInDB);  returnCREAPI_STATUS_ERR_MALLOC;  }  curr_actbuf_ptr=pActiveWordsBuffer;  token=strtok(pMap,seps);  while(token!=NULL)(  pszWord=GlobalAlloc(GPTR,strlen(token)+1);  if(!pszWord){  free(pActiveWordsBuffer);  GlobalFree(pMap);  free(pWordsInDB);  returnCREAPI_STATUS_ERR_MALLOC;  }strcpy(pszWord,token);  pszWord=str_alltrim(pszWord);  str_to_upper(pszWord);  p=strchr(pszWord,′/′);  if(!p){  free(pActiveWordsBuffer);  GlobalFree(pszWord);  GlobalFree(pMap);  free(pWordsInDB);  returnCREAFI_STATUS_ERR_MAP_FORMAT;  }  *p=0;  pszWord=str_alltrim(pszWord);  if(szszz(pszWord,pWordsInDB)){  strcpy(curr_actbuf_ptr,pszWord);  curr_actbuf_ptr+=(strlen(pszWordl+1);  }else{  free(pActiveWordsBuffer);  GlobalFree(pszWord);  GlobalFree(pMap);  free(pWordsInDB);  returnCREAPI_STATUS_ERR_WORDNOTEXIST;  }  GlobalFree(pszWord);  token=strtok(NULL,seps);  }  *curr_actbuf_ptr=′\0′;  status=asrRecSetActiveWords(hAsr,hCtx,ASRREC_DISACTIVATION,″Word″,pWordsInDB);  if(status!=ASRERR_OK){  free(pActiveWordsBuffer);  GlobalFree(pMap);  free(pWordsInDB);  returnstatus+SR_MIN_ERR_VALUE;  free(pWordsInDB);  status=asrRecSerActiveWords(hAsr,hCtx,ASRREC_ABSOLUTEACTIVATION,″Word″,pActiveWordsBuffer);if(status?。紸SRERR_OK;{  free(pActiveWordsBuffer);  GlobalFree(pMap);  free(pWordsInDB);  returnstatus+SR_MIN_ERR_VALUE;  }  free(pActiveWordsBuffer);  crapi_status=crSendMessage(NULL,CMD_BASE_START_AD,0,NULL,0);  if(crapi_status?。絊TATUS_OK){  GlobalFree(pMap);  returncrapi_status;  }  userThreadID=GetCurrentThreadId();  ResetEvent(hEventEvent);  status=srStart();  if(status!=ASRERR_OK){  GlobalFree(pMap);  returnstatus;  }  hWEThread=CreateThread(NULL,0,WEThread,(PVOID)time_ms,0,&amp;amp;dwThreadID);  if(hWEThread==NULL){  GlobalFree(pMap);  returnCREAPI_STATUS_ERR_MALLOC;  }  while(TRUE){  GetMessage(&amp;amp;Msg,NULL,0,0);  if(Msg.message==srMessage){  break;  }  else{  TranslateMessage(&amp;amp;Msg);  DispatchMessage(&amp;amp;Msg);  }  }SetEvent(hEventEvent);status=srStop();if(status?。紸SRERR_OK){  GlobalFree(pMap);  returnstatus;}WaitForSingleObject(hWEThread,INFINITE);dwWaitRetValue=Msg.wParam;CloseHandle(hWEThread);if(dwWaitRetValue==WE_TIMEOUT){  GlobalFree(pMap);  *pwResult=WE_TIMEOUT;  returnSTATUS_OK;}strcpy(pMap,pszWordMap);token=strtok(pMap,seps);while(token?。絅ULL){  pszWord=GlobalAlloc(GPTR,strlen(token)+1);  if(!pszWord){  GlobalFree(pMap);  returnCREAPI_STATUS_ERR_MALLOC;  }  strcpy(pszWord,token);  pszWord=str_alltrim(pszWord);  str_to_upper(pszWord);  p=strchr(pszWord,′/′);  *p=0;  pszRetVal=p+1;  pszWord=str_alltrim(pszWord);  if(strcmp(last_sr_result->szResult,pszWord)==0){  pszRetVal=str_alltrim(pszRetVal);  *pwResult=atoi(pszRetVal);  GlobalFree(pMap);  GlobalFree(pszWord);  returnSTATUS_OK;  }  GlobalFree(pszWord);  token=strtok(NULL,seps);}*pwResult=WE_NOTFOUND;  GlobalFree(pMap);  returnSTATUS_OK;}//==================================#include<string.h>#include<stdlib.h>#include″strsupp.h″char*szszz(char*pSz,char*pSzz){  while(*pSzz){  if(strcmp(pSz,pSzz)==0)  returnpSzz;  pSzz+=(strlen(pSzz)+l);  }  returnNULL;voidstr_to_upper(char*str){  while(*str){  *str=toupper(*str);  str++;  }char*str_alltrim(char*str){  char*new_start_pos=str;  char*reverse_ptr;  while(*new_start_pos==′′||*new_start_pos==′\t′)  new_start_pos++;  reverse_ptr=str+strlen(str)-1;  while(*reverse_ptr==′′||*reverse_ptr==′\t′)  reverse_ptr--;  *(reverse_ptr+1)=′\0′;  strcpy(str,new_start_pos);  returnstr;}#define_CREAPI_DLL_#include#include#include″ttssdk32.h″#include″resource.h″#include″creapi.h″#include″uniprt.h″#include″tts.h″externHINSTANCEhInstance;HTTSINSTANCEhTTSInst;TTSSYSTEMINFOTTSSystemInfo;DWORDttsOpen(){  intstatus,i,nEngineID;  charlanguage(80];  status=TtsInitialize(&amp;amp;hTTSInst,NULL,&amp;amp;TTSSystemInfo);  if(status!=R_SUCCESSFUL)  returnstatus+TTS_MIN_ERR_VALUE;  if(!LoadString(hInstance,IDS_TTS_LANGUAGE,language,sizeof(language)))  returnGetLastError();  for(i=0;i<TTSSystemInfo.nMaxEngines;i++){  if(strcmp(language,TTSSystemInfo.mTtsEg[i].szLanguage)==0){  nEngineID=TTSSystemInfo.mTtsEg[i].nEngineId;  break;  }  }  status=TtsSelectEngine(hTTSInst,nEngineID,TRUE);  if(status?。絉_SUCCESSFUL){  status=TtsUninitialize(hTTSInst);  returnstatus+TTS_MIN_ERR_VALUE;  }  status=TtsSetFreq(hTTSInst,M_FREQ_8KHZ);  if(status?。絉_SUCCESSFUL){  status=TtsUninitialize(hTTSInst);  returnstatus+TTS_MIN_ERR_VALUE;  }  returnSTATUS_OK;}DWORDttsClose(){  intstatus;  status=TtsUninitialize(hTTSInst);  if(status?。絉_SUCCESSFUL)  returnstatus+TTS_MIN_ERR_VALUE;}CREAPI_STATUScrTsGetSpeechMode(PTTS_SPEECH_MODEpSpeechMode)  intstatus;  status=TtsGetSpeechMode(hTTSInst,  &amp;amp;pSpeechMode->Volume,  &amp;amp;pSpeechMode->Speaker,  &amp;amp;pSpeechMode->SpeechRate,  &amp;amp;pSpeechMode->Pitch,  &amp;amp;pSpeechMode->PauseDur,  &amp;amp;pSpeechMode->ReadMode);  if(status?。絉_SUCCESSFUL)  returnstatus+TTS_MIN_ERR_VALUE;  returnSTATUS_OK;}CREAPI_STATUScrTsSetSpeechMode(PTTS_SPEECH_MODEpSpeechMode){  intstatus;  status=TtsSetSpeechMode(hTTSInst,F(xiàn)ALSE,  pSpeechMode->Volume,  pSpeechMode->Speaker,  pSpeechMode->SpeechRate,  pSpeechMode->Pitch,  pSpeechMode->PauseDur,  pSpeechMode->ReadMode);  if(status!=R_SUCCESSFUL)  returnstatus+TTS_MIN_ERR_VALUE;  returnSTATUS_OK;}]]></pre>#ifndef_MESS_H_#define_MESS_H_#defineSRC_DEST_TCU1#defineSRC_DEST_BASE0#defineACK_EXPECTED_MASK0x20#defineSRC_DEST_MASK0x40#defineDIRECTION_MASK0x80#defineCMD_BASE_RESET0x21#defineCMD_BASE_START_DA0x00#defineCMD_BASE_START_AD0x02#defineCMD_BASE_STOP_DA0x01#defineCMD_BASE_GET_VERSION0x20#defineCMD_BASE_BREAK0x22#defineACK_BASE_BREAK0x82#defineACK_BASE_FINISHED_DA0x90#defineACK_BASE_GET_VERSION0x80#defineACK_BASE_RESET0x81#defineBASE_ACK_TIME_OUT1000#defineUNIT_ACK_TIMEOUT1000#defineMAX_MESSAGE_SIZE255#endif//_MESS_H_#ifndef_MMIO_H_#define_MMIO_H_BOOLPCMInitFile(LPCTSTRPszFileName);BOOLPCMReadFile(PVOIDpBuffer,DWORDbytes_to_read,PDWORDwas_read);DWORDPCMGetDataSize();BOOLPCMCloseFile();#endif#ifndef_SR_H_#define_SR_H_BOOLsrOpen();BOOLsrClose();#endif//_SR_H_#ifndef_STRSUPP_H_#defin__STRSUPP_H_char*szszz(char*pSz,char*pSzz);voidstr_to_upper(char*str);char*str_alltrim(char*str);#endif//_STRSUPP_H_#ifndef_TTS_H_#define_TTS_H_DWORDttsOpen();DWORDttsClose();#endif//_TTS_H_#defineBAsEIO_READ_QUEUE#defineBASEIO_WRITE_QUEUE#defineSTATUS_OK0#defineBASEIO_ERR_COM_READ1#defineBASEIO_ERR_MEM_ALLOC2#defineBASEIO_ERR_COM_WRITE3#defineBASEIO_ERR_BREAK4#defineBASEIO_ERR_MEDIA_CONNECT5#defineBASEIO_ERR_MEDIA_SETUP6#defineBASEIO_ERR_ALREADY_CONNECTED7#defineBASEIO_ERR_NOT_CONNECTED8#defineBASEIO_ERR_RESET_NOT_COMPLETE9#defineCRPRO_ERR_MALLOC101#defineCRPRO_CONTROL_TOO_LONG102#defineCREAPI_STATUS_ERR_WRONGSTATE201#defineCREAPI_STATUS_ERR_PCMINIT202#defineCREAPI_STATUS_ERR_MALLOC203#defineCREAPI_STATUS_ERR_PCMREAD204#defineCREAPI_STATUS_ERR_BASENOTFOUN205#defineCREAPI_STATUS_ERR_TIMEOUT206#defineCREAPI_STATUS_ERR_SROPEN207#defineCREAPI_STATUS_ERR_SRINTERNAL208#defineCREAPI_STATUS_ERR_BUFFERTOOSMALL209#defineCREAPI_STATUS_ERR_WORDNOTEXIST210#defineCREAPI_STATUS_ERR_CNTXNOTACTIVE211#defineCREAPI_STATUS_ERR_LOADSTRING212#defineCREAPI_STATUS_ERR_BUFFER_TOO_SMALL212#defineCREAPI_STATUS_ERR_CNTX_NOT_FOUND213#defineCREAPI_STATUS_ERR_CNTX_INACTIVE214#defineCREAPI_STATUS_ERR_MAP_FORMAT215#defineCREAPI_STATUS_ERR_SYS_ERROR216#defineCREAPI_STATUS_ERR_RESULT_NOT_EXIST217#defineCREAPI_STATUS_ERR_FLAG_NOTSUPP218#defineCREAPI_STATUS_ERR_FILE_CREATE219#defineCREAPI_STATUS_ERR_FILE_WRITE220#defineCREAPI_STATUS_ERR_CONTEXTNAME221#defineSR_MIN_ERR_VALUE300#defineTTS_MIN_ERR_VALUE400CRPRO.DLL系列單端口PC軟件協(xié)議實現(xiàn)模塊Crpro.dll<prelisting-type="program-listing"xml:space="preserve"><![CDATA[//crpro.c#define_CRPRO_DLL#include″crpro.h″#include″..\baseio\baseio.h″#include″..\capi\uniprt.h″#defineID_BYTE0x05#defineMAX_MESSAGE_SIZE255#defineCRPRO_INTERNAL_USE1BYTEMARKER()=(0xFF,ID_BYTE);BYTEControlBuffer[MAX_MESSAGE_SIZE+2];DWORDBytesInControlBuffer=0;DWORDMarkerWasRead=0;DWORDdwReadUserData=0;BYTECountCheckSumm(PBYTEpBuffer,DWORDdwBufferSize);voidPrepareBuffer(PVOIDpBuffer,DWORDdwBufferSize);voidProcessInputBuffer(PBUFFER_HEADERpBufferHeader);PVOIDControlSequenceSearch(PBYTEpBuffer,DWORDdwBufferSize);voidCALLBACKReadNotifyCallback(DWORDdwNotifType,PBUFFER_HEADERpBufferHeader);voidCALLBACKWriteNotifyCallback(DWORDdwNotifType,PBUFFER_HEADERpBufferHeader);NOTIFY_PROCUserReadCallback;NOTIFY_PROCUserWriteCallback;//=============================================CRPRO_STATUSproTransferReset(DWORDdwFlags){  returnbioTransferReset(dwFlags);}//=============================================CRPRO_STATUSproSendMessage(PVOIDpMessage,BYTEbyMessageSize,BYTEbyMessageType){  PCONTROL_HEADERpControlHeader;DWORDactual_size;  BYTEcheck_summ;  DWORDstatus;  if(byMessageSize>MAX_MESSAGE_SIZE)  returnCRPRO_ERR_CONTROL_TOO_LONG;  actual_size=sizeof(CONTROL_HEADER)+byMessageSize;  pControlHeader=(PCONTROL_HEADER)GlobalAlloc(GPTR,actual_size);  if(!pControlHeader)  returnCRPRO_ERR_MALLOC;  memcpy(pControlHeader->Marker,MARKER,MARKER_SIZE);  pControlHeader->MessageType=byMessageType;  pControlHeader->MessageSize=byMessageSize;  memcpy(&amp;amp;(pControlHeader->MessageFirstByte),pMessage,byMessageSize);  check_summ=CountCheckSumm(&amp;amp;(pControlHeader->MessageType),actual_size-MARKER_SIZE-1);  *(((PBYTE)(pControlHeader))+actual_size-1)=check_summ;  status=bioAddOutBuffer(pControlHeader,actual_size,0,CRPRO_INTERNAL_USE);  if(status?。絊TATUS_OK)  GlobalFree(pControlHeader);  returnstatus;}//======================================CRPRO_STATUSproSendBuffer(PVOIDpBuffer,DWORDdwBufferSize,DWORDdwUserData,DWORDdwFlags){  PrepareBBuffer(pBuffer,dwBufferSize);//0xFF->0xFE  dwFlags&amp;amp;=-CRPRO_INTERNAL_USE;  returnbioAddOutBuffer(pBuffer,dwBufferSize,dwUserData,dwFlags);}//======================================CRPRO_STATUSproSystemOpen(UINTDeviceID,NOTIFY_PROCReadCallback,NOTIFY_PROCWriteCallback){  UserReadCallback=ReadCallback;  UserWriteCallback=WriteCallback;  returnbioMediaConnect(DeviceID,ReadNotifyCallback,WriteNotifcallback);//=======================================CRPRO_STATUSproSystemClose(){  returnbioMediaDisconnect();//=======================================voidCALLBACKReadNotifyCallback(DWORDdwNotifType,PBUFFER_HEADERpBufferHeader){  switch(dwNotifType){  caseBASEIO_READ_BUFFER_READY  ProcessInputBuffer(pBufferHeader);  return;  caseBASEIO_ASYNC_ERROR  break;  }//=======================================voidCALLBACKWriteNotifyCallback(DWORDdwNotifType,PBUffer_HEADERpBufferHeader){  NOTIFY_PARAMSnotify_params;  if(UserWriteCallback?。絅ULL){  switch(dwNotifType){  caseBASEIO_WRITE_BUFFER_DONE  notify_params.pBuffer=(PBYTE)pBufferHeader->pBuffer;  notify_params.dwBufferLength=pBufferHeader->dwBufferSize;  if(pBufferHeader->dwFlags&amp;amp;CRPRO_INTERNAL_USE){  (PBYTE)notify_params.pBuffer+=2;  notify_params.dwBufferLength-=3;  }  notify_params.dwUserData=pBufferHeader->dwUser;  notify_params.dwFlags=pBufferHeader->dwFlags;  if(pBufferHeader->dwFlags&amp;amp;CRPRO_INTERNAL_USE)  notify_params.dwNotifyType=CRPRO_WRITE_MESSAGE_DONE;  else  notify_params.dwNotifyType=CRPRO_WRITE_BUFFER_DONE;  break;caseBASEIO_WRITE_BREAK  notify_params.pBuffer=(PBYTE)pBufferHeader->pBuffer;  notify_params.dwBufferLength=pBufferHeader->dwBufferSize;  if(pBufferHeader->dwFlags&amp;amp;CRPRO_INTERNAL_USE){  (PBYTE)notify_params.pBuffer+=2;  notify_params.dwBufferLength-=3;  }  notify_params.dwUserData=pBufferHeader->dwUser;  notify_params.dwFlags=pBufferHeader->dwFlags;  if(pBufferHeader->dwFlags&amp;amp;CRPRO_INTERNAL_USE)  notify_params.dwNotifyType=CRPRO_WRITE_MESSAGE_BREAK;  else  notify_params.dwNotifyType=CRPRO_WRITE_BUFFER_BREAK;  break;  caseBASEIO_ASYNC_ERROR  notify_params.pBuffer=pBufferHeader->pBuffer;  notify_params.dwBufferLength=pBufferHeader->dwBufferSize;  notify_params.dwUserData=pBufferHeader->dwUser;  notify_params.dwFlags=pBufferHeader->dwFlags;  notify_params.dwNotifyType=CRPRO_ASYNC_ERROR;  break;  }  UserWriteCallback(&amp;amp;notify_params);  if(pBufferHeader->dwFlags&amp;amp;CRPRO_INTERNAL_USE)(  GlobalFree(pBufferHeader->pBuffer);  return;  }  }}//=====================================voidPrepareBuffer(PVOIDpBuffer,DWORDdwBufferSize){  DWORDsize_to_search=dwBufferSize;  PBYTEpBuffer_to_search=(PBYTE)pBuffer;  PBYTEptr;  while((ptr=memchr(pBuffer_to_search,0xFF,size_to_search))){  *ptr=0xFE;  size_to_search-=(ptr-pBuffer_to_search+1);  pBuffer_to_saarch=ptr+1;  }}//============================================voidProcessInputBuffer(PBUFFER_HEADERpBufferHeader)-(  NOTIFY_PARAMSnotify_params;  PBYTEpBuffer=pBufferHeader->pBuffer;  DWORDdwBufferSize=pBufferHeader->dwBufferSize;  DWORDmin_buff_length;  PBYTEpControlSequence;  while(dwBufferSize>0){  if(MarkerWasRead>0){  if(MarkerWasRead?。組ARKER_SIZE){  min_buff_length=min(dwBufferSize,MARKER_SIZE-MarkerWasRead);  if(memcmp(pBuffer,MARKER+MarkerWasRead,min_buff_length)==0){  MarkerWasRead+min_buff_length;  pBuffer+=min_buff_length;  dwBufferSize-=min_buff_length;  }else  MarkerWasRead=0;  }  if(MarkerWasRead==MARKER_SIZE){  if(BytesInControlBuffer<2){  min_buff_length=min(dwBufferSize,2-BytesInControlBuffer);  memcpy(ControlBuffer+BytesInControlBuffer,pBuffer,min_buff_length);  pBuffer+min_buff_length;  dwBufferSize-=min_buff_length;  BytesInControlBuffer+=min_buff_length;  }  if(BytesInControlBuffer>1){  min_buff_length=min((BYTE)dwBufferSize,ControlBuffer[1]+1);  memcpy(ControlBuffer+BytesInControlBuffer,pBuffer,min_buff_length);  pBuffer+=min_buff_length;  dwBufferSize-=min_buff_length;  BytesInControlBuffer+=min_buff_length;  }  }  }if(BytesInConcrolBuffer>1&amp;amp;&amp;amp;ControlBuffer[1]==ByceslnControlBuffer-3f&amp;amp;&amp;amp;UserReadCallback!=NULL){  BYTEcheck_sum;  check_sum=CountCheckSumm(ControlBuffer,BytesrnControlBuffer-1);  if(check_sum==ControlBuffer[BytesInControlBuffer-1]){  notify_params.pBuffer=ControlBuffer;  notify_params.dwBufferLength=BytesInControlBuffer-1;  notify_params.dwUserData=dwReadUserData;  notify_params.dwNotifyTye=CRPRO_CNTR_RECEIVED;  notify_params.dwFlags=pBufferHeader->dwFlags;  UserReadCallback(&amp;amp;notify_params);  }  MarkerWasRead=0;  BytesInControlBuffer=0;  }  if(dwBufferSize>0){  if(UserReadCallback?。絅ULL){  pControlSequence=ControlSequenceSearch(pBuffer,dwBufferSize);  notify_params.pBuffer=pBuffer;  if(pControlSequence==NULL){  if(pBuffer[dwBufferSize-1]==MARKER){  dwBufferSize--;  MarkerWasRead=1;  }  notify_params.dwBufferLength=dwBufferSize;  }else(  notify_params.dwBufferLength=pControlSequence-pBuffer;  MarkerWasRead=MARKER_SIZE;  dwBufferSize-=MARKER_SIZE;  pBuffer+=MARKER_SIZE;  }  if(notify_params.dwBufferLength>0){  notify_params.dwUserData=dwReadUserData;  notify_params.dwNotifyType=CRPRO_READ_BUFFER_READY;  notify_params.dwFlags=pBufferHeader->dwFlags;  UserReadCallback(&amp;amp;notify_params);  pBuffer+=notify_params.dwBufferLength;  dwBufferSize-=notify_params.dwBufferLength;}  }}//=================================PVOIDControlSequenceSearch(PBYTEpBuffer,DWORDdwBufferSize){  DWORDsize_to_search=dwBufferSize;  PBYTEpBuffer_to_search=(PBYTE)pBuffer;  PBYTEptr;  PBYTEpLastByte=pBuffer+dwBufferSize-1;  while((ptr=memchr(pBuffer_to_search,MARKER,size_to_search))){  if(ptr?。絧LastByte&amp;amp;&amp;amp;ptr[1]==ID_BYTE){  returnptr;  }  size_to_search-=(ptr-pBuffer_to_search+1);  pBuffer_to_search=ptr+1;  }  returnNULL;//=================================BYTECountCheckSumm(PBYTEpBuffer,DWORDdwBufferSize){  BYTEcheck_summ=0;  unsignedinti;  for(i=0;i<dwBufferSize;i++)  check_summ+=pBuffer[i];  returncheck_summ;}//=================================CRPRO_STATUSproSetReadUserData(DWORDdwUserData){  dwReadUserData=dwUserData;  returnSTATUS_OK;}//=================================#ifndef_CRPRO_H_#define_CRPRO_H_#ifdef_cplusplusextern″C″(#endif//_cplusplus#include<windows.h>#ifdef_CRPRO_DLL_#defineCRPRO_STATUS_decispec(dllexport)DWORD#else#defineCRPRO_STATUSDWORD#endif#defineCRPRO_WRITE_BUFFER_DONE1#defineCRPRO_READ_BUFFER_READY2#defineCRPRO_CNTR_RECEIVED3#defineCRPRO_WRITE_BUFFER_BREAK4#defineCRPRO_ASYNC_ERROR5#defineCRPRO_WRITE_MESSAGE_DONE6#defineCRPRO_WRITE_MESSAGE_BREAK7#defineMARKER_SIZE#pragmapack(1)typedefstruct_CONTROL_HEADER{  BYTEMarker[MARKER_SIZE];  BYTEMessageType;  BYTEMessageSize;  BYTEMessageFirstByte;}CONTROL_HEADER,*PCONTROL_HEADER;typedefstruct_NOTIFY_PARAMS(  DWORDdwNotifyType;  PVOIDpBuffer;  DWORDdwBufferLength;  DWORDdwUserData;  DWORDdwFlags;  DWORDdwStatus;}NOTIFY_PARAMS,*PNOTIFY_PARAMS;typedefvoid(CALLBACK*NOTIFY_PROC)(PNOTIFY_PARAMSpNotifyParams);CRPRO_STATUSproSystemOpen(UINTDeviceID,NOTIFY_PROCReadCallback,NOTIFY_PROCWriteCallback);CRPRO_STATUSproSystemClose();CRPRO_STATUSproSendMessage(PVOIDpMessage,BYTEbyMessageSize,BYTEbyMessageType);CRPRO_STATUSproSendBuffer(PVOIDpBuffer,DWORDdwBufferSize,DWORDdwUserData,DWORDdwFlags);CRPRO_STATUSproTransferReset(DWORDdwFlags);CRPRO_STATUSproSetReadUserData(DWORDdwUserData);#ifdef_cplusplus}#endif//_cplusplus#endif//_CRPRO_H_]]></pre>BASEIO.DLLPC軟件媒體輸入輸出模塊baseio.dll<prelisting-type="program-listing"xml:space="preserve"><![CDATA[//baseic.c#define_BASEIO_DLL#include<windows.h>#include<stdio.h>#include″queue.h″#include″baseio.h″#include″..\capi\uniprt.h″#defineCHECK_TIME_SLEEP15#defineREAD_BUFFER_SIZE1024#defineDRIVER_READ_BUFFER_SIZE16384#defineDRIVER_WRITE_BUFFER_SIZE16384BOOLCommSettingsInit(HANDLEhCom);BASEIO_CALLBACKUserReadCallback;BASEIO_CALLBACKUserWriteCallback;HQUEUEhWriteQueue;HANDLEhWriteThread;HANDLEhReadThread;HANDLEhCom=INVALID_HANDLE_VALUE;//=================================DWORDWINAPIReadThread(PVOIDparam){  PBUFFER_HEADERpHeader;  COMSTATcomstat;  DWORDnb,was_read,dwError,mask;  for(;;){  ClearCommError(hCom,&amp;amp;dwError,&amp;amp;comstat);  while(comstat.cbInQue==0){  WaitCommEvent(hCom,&amp;amp;mask,NULL);  ClearCommError(hCom,&amp;amp;dwError,&amp;amp;comstat);  }  nb=comstat.cbInQue;  Sleep(CHECK_TIME_SLEEP);  ClearCommError(hCom,&amp;amp;dwError,&amp;amp;comstat);  if(nb==comstat.cbInQue||comstat.cbInQue>=READ_BUFFER_SIZE){  pHeader=(PBUFFER_HEADER)GlobalAlloc(GPTR,sizeof(BUFFER_HEADER));pHeader->pBuffer=(PVOID)GlobalAlloc(GPTR,comstat.cbInQue);  ReadFile(hCom,pHeader->pBuffer,comstat.cbInQue,&amp;amp;was_read,NULL);  pHeader->dwBufferSize=comstat.cbInQue;  UserReadCallback(BASEIO_READ_BUFFER_READY,pHeader);  GlobalFree(pHeader->pBuffer);  GlobalFree(pHeader);  }  }  return0;}//======================================DWORDWINAPIWriteThread(PVOIDparam){  PBUFFER_HEADERpHeader;  DWORDwritten;  DWORDdwNotifyType;  for(;;){  QueueWaitWhileEmpty(hWriteQueue,INFINITE);  pHeader=(PBUFFER_HEADER)QueuePop(hWriteQueue);  if(pHeader->dwBufferSize?。?){  GetOverlappedResult(hCom,&amp;amp;pHeader->overlapped,&amp;amp;written,TRUE);  dwNotifyType=(written==0?BASEIO_WRITE_BREAKBASEIO_WRITE_BUFFER_DONE);  }else  dwNotifyType=BASEIO_WRITE_BUFFER_DONE;  UserWriteCallback(dwNotifyType,pHeader);  CloseHandle(pHeader->overlapped.hEvent);  GlobalFree(pHeader);  }  return0;//======================================BAIO_STATUSbioMediaConnect(DWORDdwDeviceID,NASEIO_CALLBACKReadCallback,BASEIO_CALLBACKWriteCallback){  DWORDdwThreadID;  charszPort[16];sprintf(szPort,″%sid″,″COM″,dwDeviceID);  hCom=CreateFile(szPort,GENERIC_READ|GENERIC_WRITE,0,NULL,OPEN_EXISTING,F(xiàn)ILE_ATTREBUTE_NORMAL(FILE_FLAG_OVERLAPPED,NULL);  if(hCom==INVALID_HANDLE_VALUE)  returnBASEIO_ERR_MEDIA_CONNECT;  UserReadCallback=ReadCallback;  UserWriteCallback=WriteCallback;  if(!CommSettingsInit(hCom)){  CloseHandle(hCom);  hCom=INVALID_HANDLE_VALUE;  returnBASEIO_ERR_MEDIA_SETUP;  }  hWriteQueue=QueueCreate();  hReadThread=CreateThread(NULL,0,ReadThread,0,0,&amp;amp;dwThreadID);  SetThreadPriority(hReadThread,THREAD_PRIORITY_HIGHEST);  hWriteThread=CreateThread(NULL,0,WriteThread,0,0,&amp;amp;dwThreadID);  SetThreadPriority(hWriteThread,THREAD_PRIORITY_HIGHEST);  returnSTATUS_OK;}//======================================BASIO_STATUSbioMediaDisconnect(){  if(hCom=INVALID_HANDLE_VALUE)  returnBASEIO_ERR_NOT_CONNECTED;  bioTransferReset(BASEIO_READ_QUEUE|BASEIO_WRITE_QUERE);  TerminateThread(hReadThread,0);  CloseHandle(hReadThread);  TerminateThread(hWriteThread,0);  CloseHandle(hWriteThread);  QueueDestroy(hWriteQueue);  CloseHandle(hCom);hCom=INVALID_HANDLE_VALUE;  returnSTATUSOK;}//======================================BASIO_STATUSbioAddOutBuffer(PVOIDpBuffer,DWORDdwBufferSize,DWORDdwUser,DWORDdwFlags){  PBUFFER_HEADERpHeader;  DWORDwritten;  if(hCom==INVALID_HANDLE_VALUE)  returnBASEIO_ERR_NOT_CONNECTED;  pHeader=(PBUFFER_HEADER)GlobalAlloc(GPTR,sizeof(BUFFER_HEADER));  pHeader->pBuffer=puffer;  pHeader->dwUser=dwUser;  pHeader->dwBufferSize=dwBufferSize;  pHeader->dwFlags=dwFlags;  if(dwBufferSize?。?){  pHeader->overlapped.hEvent=CreateEvent(NULL,F(xiàn)ALSE,F(xiàn)ALSE,NULL);  WriteFile(hCom,pHeader->pBuffer,pHeader->dwBufferSize,&amp;amp;written,&amp;amp;pHeader->overlapped);  }  QueuePush(hWriteQueue,pHeader);  returnSTATUS_OK;//======================================BASIO_STATUSbioTransferReset(DWORDdwFlags){  DWORDnum_elem;  if(hCom=INVAIID_HANDLE_VALUE)  returnBASEIO_ERR_NOT_CONNECTED;  if(dwFlags&amp;amp;BASEIO_WRITE_QUEUE){  num_elem=hWriteQueue->size;PurgeComm(hCom,PURGE_TXABORT);  while(QueueWaitWhileEmpty(hWriteQueue,0)==WAIT_OBJECT_0);  PurgeComm(hCom,PURGE_TXCLEAR);  }  if(dwFlags&amp;amp;BASEIO_READ_QUEUE)  PurgeComm(hCom,PURGE_RXABORT|PURGE_RXCLEAR);  returnSTATUS_OK;}//======================================BOOLCommSettingsInit(HANDLEhCom){  DCBdcb;  dcb.DCBlength=sizeof(DCB);  GetCommState(hCom,&amp;amp;dcb;  dcb.BaudRate=CBR_115200;  dcb.fBinary=TRUE;  dcb.fParity=TRUE;  dcb.fOutxCtsFlow=TRUE;  dcb.fOutxDsrFlow=FALSE;  dcb.fDtrControl=DTR_CONTROL_DISABLE;  dcb.fDsrSensitivity=FALSE;  dcb.fOutX=FALSE;  dcb.fInX=FALSE;  dcb.fNull=FALSE;  dcb.fRtsControl=RTS_CONTROL_HANDSHAKE;  dcb.ByteSize=8;  dcb.Parity=NOPARITY;  dcb.StopBits=ONESTOPBIT;  dcb.XonChar=0;  dcb.XoffChar=0;  dcb.XonLim=0;  dcb.XoffLim=0;  dcb.EvtChar=0;  if(!SetCommState(hCom,&amp;amp;dcb))  returnFALSE;  SetCommMask(hCom,EV_RXCHAR);PurqeComm(hCom,pURGE_TXABORT|PURGE_RXABORT|PURGE_TXCLEAR|PURGE_RXCLEAR);  if(!SetupComm(hCom,DRIVER_READ_BUFFER_SIZE,DRIVER_WRITE_BUFFER_SIZE))  returnFALSE;  returnTRUE;}//======================================//Queue.c#include″queue.h″//Queueimplementation//======================================HQUEUEQueueCreate(){  HQUEUEhQueue;  hQueue=(HQUEUE)GlobalAlloc(GPTR,sizeof(QUEUE));  if(hQueue==NULL)  returnNULL;  hQueue->size=0;  hQueue->first=NULL;  hQueue->hNotEmpty=CreateEvent(NULL,TRUE,F(xiàn)ALSE,NULL);  InitializeCriticalSection(&amp;amp;hQueue->crit_section);  returnhQueue;}//======================================BOOLQueuePush(HQUEUEhQueue,PVOIDdata){  PQUEUE_NODEpNew_node;  EnterCriticalSection(&amp;amp;hQueue->crit_section);  pNew_node=(PQUEUE_NODE)GlobalAlloc(GPTR,sizeof(QUEUE_NODE));  if(pNew_node==NULL)  returnFALSE;  pNew_node->data=data;  pNew_node->next=NULL;  if(hQueue->first==NULL)  hQueue->first=pNew_node;  else  hQueue->last->next=pNew_node;  hqueue->last=pNew_node;  hQueue->size++;  SetEvent(hQueue->hNotEmpty);  LeaveCriticalSection(&amp;amp;hQueue->crit_section);returnTRUE;}//======================================PVOIDQueuePop(HQUEUEhQueue){  PQUEUE_NODEnext;  PVOIDdata;  if(hQueue->first==NULL)  returnNULL;  EnterCriticalSection(&amp;amp;hQueue->crit_section);  data=hQueue->first->data;  next=hQueue->first->next;  GlobalFree(hQueue->first);  hQueue->first=next;  hQueue->size--;  if(hQueue->size==0)  ResetEvent(hQueue->hNotEmpty);  LeaveCriticalSection(&amp;amp;hQueue->crit_section);  returndata;//======================================voidQueueReset(HQUEUEhQueue){  while(WaitForSingleObject(hQueue->hNotEmpty,0)=WAIT_OBJECT_0)  QueuePop(hQueue);}//======================================voidQueueDestroy(HQUEUEhQueue){  QueueReset(hQueue);  CloseHandle(hQueue->hNotEmpty);  DeleteCriticalSection(&amp;amp;hQueue->crit_section);  GlobalFree(hQueue);}//======================================DWORDQueueWaitWhileEmpty(HQUEUEhQueue,DWORDtime_ms){returnWaitForSingleObject(hQueue->hNotEmpty,time_ms);}//======================================]]></pre>#ifndef_BASEIO_H_#define_BASEIO_H_#ifdef_cplusplusextern″C″{#endif#defineBASEIO_WRITE_BUFFER_DONE1#defineBASEIO_READ_BUFFER_READY2#defineBASEIO_WRITE_BREAK3#defineBASEIO_ASYNC_ERROR4#ifdef_BASEIO_DLL#defineBASIO_STATUS_declspec(dllexport)DWORD#else#defineBASIO_STATUS_declspec(dllimport)DWORD#endiftypedefstruct_BUFFER_HEADER(OVERLAPPEDoverlapped;PVIDpBuffer;DWORDdwBufferSize;DWORDdwUser;DWORDdwFlags;BYTEbySystem[3];}BUFFER_HEADER,*PBUFFER_HEADER;typedefvoid(CALLBACK*BASEIO_CALLBACK)(DWORDdwNotifType,PBUFFER_HEADERpBufferHeader);BASIO_STATUSbioMediaConnect(DWORDdwDeviceID,BASEIO_CALLBACKReadCallback,BAEIO_CALLBACKWriteCallback);BASIO_STATUSbioMediaDisconnect();BASIO_STATUSbioAddOutBuffer(PVOIDpBuffer,DWORDdwBufferSize,DWORDdwUser,DWORDdwFlags);BASIOSTATUSbioTransferReset(DWORDdwFlags);#ifdef_cplusplus#endif#endif//_CRPKTDRV_H_#ifndef_QUEUE_H_#define_QUEUE_H_#include&lt;windows.h&gt;typedefstructQUEUE_NODE_TAG{PVOIDdata;structQUEUE_NODE_TAG*next;}QUEUE_NODE,*PQUEUE_NODE;tyPedefstructQUEUE_TAG{HANDLEhNotEmpty;DWORDsize;PQUEUE_NODEfirst;PQUEUE_NODElast;CRITICAL_SECYIONcrit_section;}QUEUE,*QPUEUE;typedefPQUEUEHQUEUE;EQUEUEQueueCreate();BOOLQueuePush(HQUEUEhQueue,PVOIDdata);PVOIDQueuePop(HQUEUEhQueue);voidQueueReset(HQUEUEhQueue);voidQueueDestroy(HQUEUEhQueue);DWORDQueueWaitWhileEmpty(HQUEUEhQueue,DWORDtime_ms);#endif//_QUEUE_H_用于語音識別的有效源代碼//AcqPropPage.cppimplementationfile//#include″stdafx.h″#include″NewSR.h″#include″AcqPropPage.h″#include″SRCtl.h″#include&lt;mmsystem.h&gt;#ifdef_DEBUG#definenewDEBUG_NEW#undefTHIS_FILEstaticcharTHIS_FILE[]=_FILE_;#endif#defineWORK_MODE0#defineINIT_MODE1//////////////////////////////////////////////////////////////////////////////CAcqPropPagedialogIMPLEMENT_DYNCREATE(CAcqPropPage,COlePropertyPage)///////////////////////////////////////////////////////////////////////////////MessagemapBEGIN_MESSAGE_MAP(CAcqPropPage,COlePropertyPage)//({AFX_MSG_MAP(CAcqPropPage)ON_BN_CLICKED(IDC_WAVEFORMAT,OnWaveformat)ON_BN_CLICKED(IDC_DEVICEID,OnDeviceid)ON_CBN_SELCHANGE(IDC_WAVELIST,OnSelchangeWavelist)ON_BN_CLICKED(IDC_REALTIME,OnRealtime)ON_BN_CLICKED(IDC_NONREALTIME,OnNonrealtime)//}}AFX_MSG_MAPEND_MESSAGE_MAP()///////////////////////////////////////////////////////////////////////////////Initialiteclassfactoryandguid<prelisting-type="program-listing"xml:space="preserve"><![CDATA[//(D446B881-7537-11D0-A6CE-0040332D01CS)IMPLEMENT_OLECREATE_EX(CAcqPropPage,″NewSR.CAcqPropPage″,  0xd446b881,0x7537,0xl1d0,0xa6,0xce,0x0,0x40,0x33,0x2d,0x1,0xc5)///////////////////////////////////////////////////////////////////////////////CAcqPropPageCAcqPropPageFactoryUpdateRegistry-//AddsorremovessystemregistryentriesforCAcqPropPageBOOLCAcqPropPageCAcqPropPageFactoryUpdateRegistry(BOOLbRegister){  //TODODefinestringresourceforpagetype;replace′0′belowwithID.  if(bRegister)  returnAfxOleRegisterPropertyPageClass(AfxGetInstanceHsndle(),  m_clsid,IDS_SR_PPG);  else  returnAfxOleUnregisterClass(m_clsid,NULL);///////////////////////////////////////////////////////////////////////////////CAcqPropPageCAcqPropPsge-Constructor//TODODefinestringresourceforpagecaption;replace′0′belowwithID.CAcqPropageCAcqPropPage()  COlePropertyPage(IDD,IDS_ACQ){  //{{AFX_DATA_INIT(CAcqPropPage)  //}}AFX_DATA_INIT  CurrWaveFormat=NULL;}CAcqPropPage-CAcqPropPage(){  if(!CurrWaveFormat)  free(CurrWaveFormat);}///////////////////////////////////////////////////////////////////////////CAcqPropPageDoDataExchange-MovesdatabetweenpageandpropertiesvoidCAcqPropPageDoDataExchange(CDataExchange*pDX){  //NOTEClassWizardwilladdDDP,DDX,andDDVcallshere  //DONOTEDITwhatyouseeintheseblocksofgeneratedcode!  //{{AFX_DATA_MAP(CAcqPropPage)  DDX_Control(pDX,IDC_DESCRIPTION,m_EditDescription);  DDP_CBIndex(pDX,IDC_WAVELIST,m_WaveIndex,″XWaveIndex″);  DDX_CBIndex(pDX,IDC_WAVELIST,m_WaveIndex);  DDP_Text(pDX,IDC_ACQ,m_DataBase,″DataBase″);  DDP_CBIndex(pDX,IDC_ACQ,m_XSRTransfer,″XSRTransfer″);  DDP_CBIndex(pDX,IDC_WAVEFORMAT,m_XAcqMode,″XAcqMode″);  DDP_CBIndex(pDX,IDC_DEVICEID,m_XAcqMode,″XAcqMode″);  DDP_CBIndex(pDX,IDC_REALTIME,m_XAcqMode,″XAcqMode″);  DDP_CBIndex(pDX,IDC_NONREALTIME,m_XAcqMode,″XAcqMode″);  DDX_Control(pDX,IDC_WAVELIST,m_WaveList);  DDX_Control(pDX,IDC_WAVEFORMAT,m_WaveFormat);  DDX_Control(pDX,IDC_REALTIME,m_RealTime);  //}}AFX_DATA_MAP  DDP_PostProcessing(pDX);///////////////////////////////////////////////////////////////////////////////CAcqPropPagemessagehandlersBOOLCAcqPropPageOnInitDialog(){  PVOIDwf;  DWORDsize;  COlePropertyPageOnInitDialog();  CButton*CurrButton;  HDBhDb;  LPSTRBuffer;HCURSORSaveCursor;SaveCursor=SetCursor(AfxGetApp()->LoadStandardCursor(IDC_WAIT));COlePropertyPageOnInitDialog();asrDbList(NULL,&amp;amp;size);Buffer=(LPSTR)malloc(size);asrDbList(Buffer,&amp;amp;size);hDb=asrDbOpen(Buffer);if(Buffer)  free(Buffer);asrDbGetInfo(hDb,ASRDBINFO_NBRWAVEFORMATS,NULL,&amp;amp;size);wf=(DWORD*)malloc(size);asrDbGetInfo(hDb,ASRDBINFO_NBRWAVEFORMATS,wf,&amp;amp;size);nFormats=*((LPDWORD)wf);free(wf);asrDbGetInfo(hDb,ASRDBINFO_WAVEFORMATS,NULL,&amp;amp;size);CurrWaveFormat=(PWAVEFORMAT)malloc(size);asrDbGetInfo(hDb,ASRDBINF0_WAVEFORMATS,CurrWaveFormat,&amp;amp;size);switch(m_XAcqMode){caseDISP_DEVICEConstructorCSRPropPage∷CSRPropPage()  COlePropertyPage(IDD,IDS_SR_PPG_CAPTION){  //{{AFX_DATA_INIT(CSRPropPsge)  m_DataBase=_T("");  m_User=_T("");  m_Context=_T("");  m_Mode=0;  m_OpenAttr=0;  //}}AFX_DATA_INIT  ModeInfoList=NULL;}CSRPropPage∷-CSRPropPage(){  if(ModeInfoList)  free(ModeInfoList);}///////////////////////////////////////////////////////////////////////////////CSRPropPage∷DoDataExchange-MovesdatabetweenpageandpropertiesvoidCSRPropPage∷DoDataExchange(CDataExchange*pDX){  //{{AFX_DATA_MAP(CSRPropPage)  DDP_CBString(pDX,IDC_DATABASE,m_DataBase,_T("DataBase"));  DDX_CBString(pDX,IDC_DATABASE,m_DataBase);  DDP_CBString(pDX,IDC_USER,m_User,_T("User"));  DDX_CBString(pDX,IDC_USER,m_User);  DDP_CBString(pDX,IDC_CONTEXT,m_Context,_T("Context"));  DDX_CBString(pDX,IDC_CONTEXT,m_Context);DDP_CBIndex(pDX,IDC_MODES,m_Mode,_T("Mode"));  DDX_CBIndex(pDX,IDC_MODES,m_Mode);  DDP_CBIndex(PDX,IDC_ATTRI3,m_OpenAttr,_T("OpenAttr")};  DDX_CBIndex(pDX,IDC_ATTRIB,m_OpenAttr);  //}}AFX_DATA_MAP    DDP_PostProcessing(pDX);///ToolsvoidCSRPropPage∷FillDataBases(){    CStringtmp;  DWORDsize;  CComboBox*CurrComboBox;  char*Suff,*ptr;  SetControlStatus(IDC_DATABASE,TRUE);  asrDbList(NULL,&amp;amp;size);  Buff=(char*)malloc(size);  ptr=Buff;  asrDbList(Buff,&amp;amp;size);  CurrComboBox=(CComboBox*)GetDlgItem(IDC_DATABASE);  CurrComboBox->ResetContent();  while((tmp=GetNextString(&amp;amp;ptr))?。剑ⅲ?  CurrCumboBox->AddString(tmp);  if(Buff)  free(Buff);  CurrComboBox->SetCurSel(CurrComboBox->FindString(-1,m_DataBase)};}voidCSRPropPage∷FillUsers(){  CStringtmp,DbName;  DWORDsize;  CComboBox*CurrComboBox;  HDBhDb;  char*Buff,*ptr;  SetControlStatus(IDC_USER,TRUE);  CurrComboBox=(CComboBox*)GetDlgItem(IDC_DATABASE);  if(CurrComboBox->GetCurSel()==CB_ERR)  return;  CurrComboBox->GetLBText(CurrComboBox->GetCurSel(),DbName);  hDb=asrDbOpen(DbName);  asrDbGetInfo(hDb,ASRDBINFO_USERS,NULL,&amp;amp;size);  Buff=(char*)malloc(size);  asrDbGerInfo(hDb,ASRDBINFO_USERS,Buff,&amp;amp;size);ptr=Buff;  CurrComboBox=(CComboBox*)GetDlgItem(IDC_USER);  CurrComboBox->ResetContent();  while((tmp=GetNextString(&amp;amp;ptr))?。剑ⅲ?  CurrComboBox->AddString(tmp);  if(Buff)  free(Buff);  if(hDb>ASRERR_MAXERR)  asrDbClose(hDb);  CurrComboBox->SetCurSel(CurrComboBox->FindString(-1,m_User));voidCSRPropPage∷FillContexts(){  CStringtmp,user,contaxt,DbName;  DWORDsize;  CComboBox*CurrComboBox;  char*Buff,*ptr;  HDBhDb;  SetControlStatus(IDC_CONTEXT,TRUE);  CurrComboBox=(CComboBox*)GetDlgItem(IDC_DATABASE);  if(CurrComboBox->GetCurSel()==CB_ERR)  return;  CurrComboBox->GetLBText(CurrComboBox->GetCurSel(),DbName);  CurrComboBox=(CComboBox*)GetDlgItem(IDC_USER);  if(CurrComboBox->GetCurSel()==CB_ERR)  return;  CurrComboBox->GetLBText(CurrComboBox->GetCurSel(),user);  CurrComboBox=(CComboBox*)GetDlgItem(IDC_CONTEXT);  hDb=asrDbOpen(DbName);  ASRERRORa=asrUsrGetInfo(hDb,user,ASRUSRINFO_CONTEXTS,NULL,&amp;amp;size);  Buff=(char*)malloc(size);  a=asrUsrGetInfo(hDb,user,ASRUSRINFO_CONTEXTS,Buff,&amp;amp;size);  ptr=Buff;  CurrComboBox->ResetContent();  while((tmp=GetNextString(&amp;amp;ptr))?。剑ⅲ?  CurrComboBox->AddString(tmp);  if(Buff)  free(Buff);if(hDb>ASRERR_MAXERR)  asrDbClose(hDb);  CurrComboBox->SetCurSel(CurrComboBox->FindString(-1,m_Context));///////////////////////////////////////////////////////////////////////////////CSRPropPagemessagehandlersBOOLCSRPropPage∷OnInitDialog(){  HCURSORSaveCursor;  SaveCursor=SetCursor(AfxGetApp()->LoadStandardCursor(IDC_WAIT));  COlePropertyPage∷OnInitDialog();  FillDataBases();  FillUsers();  FillContexts();  FillModes();  FillOpenAttr();  SetControlStatus(IDC_DATABASE,TRUE);  SetCursor(SaveCursor);  returnFALSE;}voidCSRPropPage∷OnSelchangeContext(){voidCSRPropPage∷OnSelchangeDatabase(){  HCURSORSaveCursor;  SaveCursor=SetCursor(AfxGetApp()->LoadStandardCursor(IDC_WAIT));  FillUsers();  FillContexts();  FillModes();  SetCursor(SaveCursor);}voidCSRPropPage∷OnSelchangeUser(){  FillContexts();voidCSRPropPage∷FillModes(){  CStringtmp,DbName;  DWORDsize;  CComboBox*CurrComboBox;  HDBhDb;  HASRhAsr;  SetControlStatus(IDC_MODES,TRUE);  CurrComboBox=(CComboBox*)GetDlgItem(IDC_DATABASE);  if(CurrComboBox->GetCurSel()==CB_ERR)  return;  CurrComboBox->GetLBText(CurrComboBox->GetCurSel(),DbName);  hDb=asrDbOpen(DbName);  hAr=asrRecOpenEx(hDb,"Win32",NULL,NULL,NULL,NULL,0);  asrRecGetModeInfo(hAsr,NULL,&amp;amp;size);  ModeInfoList=(PMODEINFOLIST)malloc(size);  asrRecGetModeInfo(hAsr,ModeInfoList,&amp;amp;size);  CurrComboBox=(CComboBox*)GetDlgItem(IDC_MODES);  CurrComboBox->ResetContent();  for(inti=0;i<ModeInfoList->nbrOfModes;i++)  CurrComboBox->InsertString(ModeInfoList->info[i].ModeType,  ModeInfoList->info[i].szName);  if(hDb>ASRERR_MAXERR)  asrDbClose(hDb);  if(hAsr>ASRERR_MAXERR)  asrRecClose(hAsr);}voidCSRPropPage∷FillOpenAttr(){  CComboBox*CurrComboBox;  CurrCcmboBox=(CComboBox*)GetDlgItem(IDC_ATTRIB);  CurrCcmboBox->InsertString(-1,"Readaccess");  CurrCcmboBox->InsertString(-1,"Writeaccess");  SetControlStatus(IDC_DATABASE,TRUE);}#include″stdafx.h″#include″work.h″CStringGetNextString(char**szzString)  CStringRetString=*szzString;  *szzString+=RetString.GetLength()+1;  returnRetString;//AcqPropage.hheaderfile/////////////////////////////////////////////////////////////////////////////////CAcqPropPagePropertypagedialog#include"work.h"classCAcqPropPagepublicCOlePropertyPage{  DECLARE_DYNCREATE(CAcqPropPage)  DECLARE_OLECREATE_EX(CAcqPropPage)//Constructorspublic  CStringm_DataBase;  DWORDnFormats;  CAcqPropPage();  -CAcqPropPage();//Tools  PWAVEFORMATCurrWaveFormat;//DialogData  //{{AFX_DATA(CAcqPropPage)  enum{IDD=IDD_ACQPROPPAGE};  CEditm_EditDescription;  CComboBoxm_WaveList;  CButtonm_WaveFormat;  CButtonm_RealTime;  intm_WaveIndex;  intm_XAcqMode;  intm_XSRTransfer;  //}}AFX_DATA//Implementation  voidFillWF(intmode);  voidFillID(intmode);protected  virtualvoidDoDataExchange(CDataExchange*pDX);//DDX/DDVsupport//Messagemapsprotected  //({AFX_MSG(CAcqPropPage)  virtualBOOLOnInitDialog();  afx_msgvoidOnWaveformat();  afx_msgvoidOnDeviceid();  afx_msgvoidOnSelchangeWavelist();  afx_msgvoidOnRealtime();  afx_msgvoidOnNonrealtime();  //}}AFX_MSG  DECLARE_MESSAGE_MAP()private  voidSaveAcqMode();  enumFillType(FILL_BYDEVICEID,F(xiàn)ILL_BYNBRWAVEFORMAT);  voidFillDescription(FillTypeftype,WORDwWhat);  voidCheckAcqGroup(BOOLEnable);};//NewSR.hmainheaderfileforNEWSR.DLL#if!defined(_AFXCTL_H_)  #errorinclude′afxctl.h′beforeincludingthisfile#endif#include"resource.h"//mainsymbols///////////////////////////////////////////////////////////////////////////////CNewSRAppSeeNewSR.cppforimplementation.classCNewSRApppublicCOleControlModule{public  BOOLInitInstance();  intExitInstance();  HICONSRIcon;};externconstGUIDCDECLtlid;externconstWORD_wVerMajor;externconstWORD_wVerMinor;//PrmPrpPq.hheaderflie//#include"work.h"#include"resource.h"#include<afxcmn.h>///////////////////////////////////////////////////////////////////////////////CPrmPrpPgPropertypagedialogclassCPrmPrpPgpublicCOlePropertyPage{  DECLARE_DYNCREATE(CPrmPrpPg)  DECLARE_OLECREATE_EX(CPrmPrpPg)//Constructors&amp;amp;&amp;amp;Destructorpublic  CPrmPrpPg();  -CPrmPrpPg();//Tools  PPARAMINFOLISTParamInfo;//DialogData  //{{AFX_DATA(CPrmPrpPg)  enum{IDD=IDD_PARAMINFO};  CListBoxm_Result;  CListBoxm_ListWords;  CButtonm_SetDef;  CSliderCtrlm_Slider;  CStaticm_CurrentValue;  CStaticm_Min;  CStaticm_Max;  CStaticm_Description;  CListBoxm_Params;  CStringm_DataBase;  intm_Control;  //}}AFX_DATA//Implementationprotected  virtualvoidDoDataExchange(CDataExchange*pDX);//DDX/DDVsupport//Messagemapsprotected  //{{AFX_MSG(CPrmPrpPg)  virtualBOOLOnInitDialog();  afx_msgvoidOnSelchangeListl();  afx_msgvoidOnHScroll(UINTnSBCode,UINTnPos,CScrollBar*pScrollBar);  afx_msgvoidOnDefaultvalue();  //}}AFX_MSG  DECLARE_MESSAGE_MAP()};//SRCtl.hDeclarationoftheCSRCtrlOLEcontrolclass.///////////////////////////////////////////////////////////////////////////////CSRCtrlSeeSRCtl.cppforimplementation.#include"work.h"classCSRCtrlpublicCOleControl{  DECLARE_DYNCREATE(CSRCtrl)private  longRecStop();  longRecStart();  voidChangeStart();  CBitmapSRBitMap;//Constructorpublic  intMemChange(void*Buffer,chard,chars,DWORDdwLength);  voidInitDefaults();  intPostPropExchange(CPropExchange*pPX);  intPrePropExchange(CPropExchange*pPX);  voidSRCtrlInit();  CSRCtrl();  ASRERRORCheckError(longcode);//Overrides  //Drawingfunction  virtualvoidOnDraw(  CDC*pdc,constCRect&amp;amp;rcBounds,constCRect&amp;amp;rcInvalid);  //Persistence  virtualvoidDoPropExchange(CPropExchange*pPX);  //Resetcontrolstate  virtualvoidOnResetState();  virtualBOOLOnSetExtent(LPSIZELlpSizeL);//Tools  SRStructSR;//intInitProperties();  PWAVEFORMATPWayeFormats;  PERSIST_PRROP*PersistProp;//Implementationprotected  -CSRCtrl();  DECLARE_OLECREATE_EX(CSRCtrl)//Classfactoryandguid  DECLARE_OLETYPELIB(CSRCtrl)//GetTypeInfo  DECLARE_PROPPAGEIDS(CSRCtrl)//PropertypageIDs  DECLARE_OLECTLTYPE(CSRCtrl)//Typenameandmiscstatus//Messagemaps  //{{AFX_MSG(CSRCtrl)  afx_msgLRESULTOnConfirm(WPARAMwParam,LPARAMlParam);  afx_msgLRESULTOnError(WPARAMwParam,LPARAMlParam);  afx_msgLRESULTOnGainRequest(WPARAMwParam,LPARAMlParam);  afx_msgLRESULTOnProgress(WPARAMwParam,LPARAMlParam);  afx_msgLRESULTOnPrompt(WPARAMwParam,LPARAMlParam);  afx_msgLRESULTOnState(WPARAMwParam,LPARAMlParam);  afx_msgLRESULTOnTrained(WPARAMwParam,LPARAMlParam);  afx_msgLRESULTOnUpdate(WPARAMwParam,LPARAMlParam);  afx_msgLRESULTOnSRNotify(WPARAMwParam,LPARAMlParam);  //}}AFX_MSG  DECLARE_MESSAGE_MAP()//Dispatchmaps  //{(AFX_DISPATCH(CSRCtrl)  CStringm_DataBase;  afx_msgvoidOnDataBaseChanged();  CStringm_User;  afx_msgvoidOnUserChanged();  CStringm_Context;  afx_msgvoidOnContextChanged();  shortm_Mode;  afx_msgvoidOnModeChanged();shortm_OpenAttr;  afx_msgvoidOnOpenAttrChanged();  longm_XAcqMode;  afx_msgvoidOnXAcgModeChanged();  longm_XWaveIndex;  afx_msgvoidOnXWaveIndexChanged();  BOOLm_SaveCtx;  afx_msgvoidOnSaveCtxChanged();  longm_control;  afx_msgvoidOnControlChanged();  afx_msgvoidShowProperties();  afx_msglongRecAcqWaveBuffer(LPCTSTRlpBuffer,longdwLength);  afx_msglongRecGetState();  afx_msgBSTRGetWords(shortType,LPCTSTRClass);  afx_msglongActivateWords(shortType,LPCTSTRClass,LPCTSTRWords);  afx_msgBSTRGetActiveWords();  afx_msglongInit();  afx_msglongStart();  afx_msglongStop();  afx_msglongClose();  afx_msglongGetParam(longParamType);  afx_msglongSetParam(longParamType,longNewValue);  afx_msglongAddUserWord(LPCTSTRClass,LPCTSTRWord);  afx_msglongCtxActivate(BOOLActivate);  afx_msglongDictClose(BOOLSaveChanges);  afx_msglongDictCopy(LPCTSTRLanguage,LPCTSTRDictSrc,LPCTSTRDictDest);  afx_msglongDictCreate(LPCTSTRLanguage,LPCTSTRDictionary);  afx_msglongDictDelete(LPCTSTRLanguage,LPCTSTRDictionary);  afx_msglongDictDeleteException(LPCTSTRWord);  afx_msgVARIANTDictGetInfo(shortType);  afx_msgBSTRDictGetTranscription(LPCTSTRWord);  afx_msglongDictOpen(LPCTSTRLanguage,LPCTSTRDictionary,shortAttrib);  afx_msglongDictRename(LPCTSTRLanguage,LPCTSTRDictSrc,LPCTSTRDictDest);  afx_msglongDbClose();  afx_msglongDbCreate(LPCTSTRDbName,LPCTSTRPath);  afx_msglongDbDelete(LPCTSTRDbName);  afx_msglongDbExport(shortType,LPCTSTRLangOrUser,LPCTSTRName,LPCTSTRPath);  afx_msgVARIANTDbGetCaps(LPCTSTREnvironment,longType);  afx_magVARIANTDbGetInfo(shortType);afx_msglongDbGetParamInfo();  afx_msglongDbInstall(LPCTSTRSetupFile,longhWnd);  afx_msgBSTRDbList();  afx_msglongDbOpen(LPCTSTRDbName);  afx_msglongDbUnInstall(shortType,LPCTSTRObjectName);  afx_msglongRecAcqClose();  afx_msgshortRecAcqGetSignalLevel();  afx_msglongRecAcqOpenEx(shortWaveFormIndex,shortType);  afx_msglongRecBreak();  afx_msglongRecClose();  afx_msglongRecSetMode(shortNewMode);  afx_msglongUsrCopy(LPCTSTRUserSrc,LPCTSTRUserDest);  afx_msglongUsrEnable(LPCTSTRUserName,LPCTSTRLanguage,shortType);  afx_msglongUsrCreate(LPCTSTRUserName);  afx_msglongUsrDelete(LPCTSTRUserName);  afx_msgVARIANTUsrGetInfo(LPCTSTRUserName,shortType);  afx_msglongUsrIndependent(LPCTSTRUserName,LPCTSTRLanguage);  afx_msglongUsrRegister(LPCTSTRUser,shortType,LPCTSTRName);  afx_msglongUsrRename(LPCTSTROldName,LPCTSTRNewName);  afx_msglongUsrUnregister(LPCTSTRUser,shortType,LPCTSTRName);  afx_msglongCtxCiose(BOOLSave);  afx_msglongCtxCopy(LPCTSTRSrcUser,LPCTSTRSrcContext,LPCTSTRDestUser,LPCTSTRDestContext);  afx_msglongCtxCreate(LPCTSTRUser,LPCTSTRLanguage,LPCTSTRSyntax,LPCTSTRContext);  afx_msglongCtxDelete(LPCTSTRUser,LPCTSTRContext);  afx_msglongCtxDeleteWord(LPCTSTRClass,LPCTSTRWord);  afx_msglongCtxExport(LPCTSTRUser,LPCTSTRFormat,LPCTSTRContext);  afx_msglongCtxOpen(LPCTSTRUser,LPCTSTRContext,shortAttrib);  afx_msglongCtxRename(LPCTSTRUser,LPCTSTROldCtx,LPCTSTRNewCtx);  afx_msglongWaitForEvent(LPCTSTRMap,shorttime_100ms,longdwFlags);  afx_msgshortGetNbrPhrases();  afx_msgBSTRGetPhrase(shortPhraseNbr);  afx_msgshortGetPhraseConfLevel(shortPhraseNbr);  //}}AFX_DISPATCH  DECLARE_DISPATCH_MAP()  afx_msgvoidAboutBox();  HGLOBALSuppProp;  HGLOBALSuppPropDef;//Eventmaps  //{{AFX_EVENT(CSRCtrl)  voidFireResult(LPCTSTRBestUtterance,shortBestConfidence,shortnbrUtterances)  (FireEvent(eventidResult,EVENT_PARAM(VTS_BSTRVTS_I2VTS_I2),BestUtterance,BestConfidence,nbrUtterances);)  voidFireRecError(longid,LPCTSTRErrorString)  (FireEvent(eventidRecError,EVENT_PARAM(VTS_I4VTS_BSTR),id,ErrorString);)  voidFireChangeState(shortNewState)  {FireEvent(eventidChangeState,EVENT_PARAM(VTS_I2),NewState);}  //}}AFX_EVENT  DECLARE_EVENT_MAP()//DispatchandeventIDspublic  BOOLm_WasResult;  char*AllTrim(char*str);  voidUpperCase(LPCTSTRstr);  LPASRRESULTLastResualt;  enum{  //{{AFX_DISP_ID(CSRCtrl)  dispidDataBase=1L,  dispidUser=2L,  dispidContext=3L,  dispidMode=4L,  dispidOpenAttr=5L,  dispidSaveCtx=8L,  dispidShowProperties=10L,  dispidRecAcqWaveBuffer=11L,  dispidRecGetState=12L,  dispidGetWords=13L,  dispidActivateWords=14L,  dispidGetActiveWords=15L,  dispidInit=16L,  dispidStart=17L,  dispidStop=18L,  dispidClose=19L,  dispidGetParam=20L,  dispidSetParam=21L,  dispidAdUserWord=22L,dispidCtxActivate=23L,dispidDictClose=24L,dispidDictCopy=25L,dispidDictCreate=26L,dispidDictDelete=27L,dispidDictDeleteException=28L,dispidDictGetInfo=29L,dispidDictGetTranscription=30L,dispidDictOpen=31L,dispidDictRename=32L,dispidDbClose=33L,dispidDbCreate=34L,dispicDbDelete=35L,dispidDbExport=36L,dispidDbGetCaps=37L,dispidDbGetInfo=38L,dispidDbGetParamInfo=39L,dispidDbInstall=40L,dispidDbList=41L,dispidDbOpen=42L,dispidDbUnInstall=43L,dispidRecAcqClose=44L,dispidRecAcqGetSignalLevel=45L,dispidRecAcqOpenEx=46L,dispidRecBreak=47L,dispidRecClose=48L,dispidRecSetMode=49L,dispidUsrCopy=50L,dispidUsrEnable=51L,dispidUsrCreate=52L,dispidUsrDelete=53L,dispidUsrGetInfo=54L,dispidUsrIndependent=55L,dispidUsrRegister=56L,dispidUsrRename=57L,dispidUsrUnregister=58L,dispidCtxClose=59L,dispidCtxCopy=60L,dispidCtxCreate=61L,dispidCtxDelete=62L,dispidCtxDeleteWord=63L,dispidCtxExport=64L,disoidCtxOpen=65L,dispidCtxRename=66L,dispidWaitForEvent=67L,dispidGetNbrPhrases=68L,dispidGetPhrase=69L,dispidGetPhraseConfLevel=70L,eventidResult=1L,eventidRecError=2L,eventidChangeState=3L,//})AFX_DISP_ID};//SRPpg.hDeclarationoftheCSRPropPagepropertypageclass.//////////////////////////////////////////////////////////////////////////////CSRPropPageSeeSRPpg.cpp.cppforimplementation.#include"work.h"classCSRPropPagepublicCOlePropertyPage{  DECLARE_DYNCREATE(CSRPropPage)  DECLARE_OLECREATE_EX(CSRPropPage)//Constructorpublic  CSRPropPage();//Destructor  -CSRPropPage();//Tools  voidFillDataBases();  voidFillUsers();  voidFillContexts();  voidFillModes();  voidFillOpenAttr();  PMODEINFOLISTModeInfoList;//DialogData  //{{AFX_DATA(CSRPropPage)  enum{IDD=IDD_PROPPAGE_SR};  CStringm_DataBase;  CStringm_User;  CStringm_Context;  intm_Mode;  intm_OpenAttr;  //}}AFX_DATA  //Implementationprotected  virtualvoidDoDataExchange(CDataEXchange*pDX);//DDX/DDVsupport//Messagemapsprotected//{{AFX_MSG(CSRPropPage)virtualBOOLOnIhitDialog();afx_msgvoidOnSelchangeContext();afx_msgvoidOnSelchangeDatabase();afx_msgvoidOnSelchangeUser();//})AFX_MSGDECLARE_MESSAGE_MAP()]]></pre>安裝源代碼<prelisting-type="program-listing"xml:space="preserve"><![CDATA[unitInstallation;interfaceusesWindows,Messages,SysUtils,Classes,Graphics,Controls,F(xiàn)orms,DiaLogs,StdCtrls,Buttons,NEWSRLib_TL3,OleCtrls,XMIDILib_TLB,ExtCtrls,PDBEngine;typeTMainInstallForm=class(TForm)  ActivateButtonTBitBtn;  XMidilTXMidi;  SRlTSR;  TimerlTTimer;  procedureFormCreate(SenderTObject);  procedureExitButtonClick(SenderTObject);  procedureActivateButtonClick(SenderTObject);  procedureBitBtn2Click(SenderTObject);  procedureFormClose(SenderTObject;varActionTCloseAction);  procedureTimerlTimer(SenderTObject);private  {Privatedeclarations}public  {Publicdeclarations}  CurrentPathstring;  CreatorPathstring;  DatabasePathstring;  GraphicsPathstring;  AudioPathstring;  UsagePathstring;  PDBEngineTPDBEngine;  functionGetCurrentPath(CurrentExeNamestring)string;end;varMainInstallFormTMainInstallForm;implementationusesSerialInstall,ToyInstall;(SR*.DEM)procedureTMainInstallForm.FormCreate(SenderTObject);begin  //WindowState=wsMaximized;  Xmidil.StartHUB;  SRl.Init;  //FillPathes  CurrentPath=GetCurrentPath(Appiication.ExeName);  CreatorPath=Copy(CurrentPath,l,Length(CurrentPath)-Length(′Executables\′));  DatabasePath=CreatorPath+′PESTO\DATABASE\′;  GraphicsPath=CreatorPath+′PESTO\GRAPHICS\′;  AudioPath=CreatorPath+′PESTO\AUDIO\′;  UsagePath=CreatorPath+′PESTO\USAGE\′;  PDBEngine=TPDBEngine.create(self);  PDBEngine.DataBasePath=DataBasePath;  PDBEngine.LoadConfiguration;end;functionTMainInstallFom.GetCurrentPath(CurrentExeNamestring)string;var  iinteger;begin  i=Length(CurrentExeName);  Whilei>0do  begin  ifCopy(CurrentExeName,i,1)=′\′theni=0  else  begin  i=i-1;  CurrentExeName=Copy(CurrentExeName,l,i);  end;  end;  Result=CurrentExeName;end;procedureTMainInstallForm.ExitButtonClick(SenderTObject);begin  Close;end;procedureTMainInstallForm.ActivateButtonClick(SenderTObject);beginHide;  SerialInstallForm.WindowState=wsMaximized;  SerialInstallForm.Show;  SerialInstallForm.Section=1;  SerialInstallForm.ShowSection(1);end;procedureTMainInstallForm.BitBtn2Click(SenderTObject);beginHide;ToyInstallForm.WindowState=wsMaximized;ToyInstallForm.Show;ToyInstallForm.Section=1;ToyInstallForm.ShowSecrion(1);end;procedureTMainInstallForm.FormClose(SenderTObject;varActionTCloseAction);beginXmidil.StopHUB;SRl.Close;PDBEngine.Free;Winexec(PChar(CurrentPath+′StoryTeller.exe′),sw_show);end;procedureTMainInstallForm.TimerlTimer(SenderTObject);beginActivateButtonClick(nil);Timerl.Enabled=False;end;end.programPESTOInstallation;usesForms,Installationin′Installation.pas′{MainInstallForm},SerialInstallin′SerialInstall.pas′{SerialInstallForm},ToyInstallin′ToyInstall.pas′{ToyInstallForm},ToySetupin′ToySetup.pas′{ToySetupForm},PDBEnginein′PDBEngine.pas′;{SR*.RES}beginApplication.Initialize;Application.CreateForm{TMainInstallForm,MainInstallForm};Application.CreateForm{TSerialInstallForm,SerialInstallForm};Application.CreateForm{TToyInstallForm,ToyInstallForm};Application.CreateForm{TToySetupForm,ToySetupForm};Application.Run;end.unitSerialInstall;interfaceusesWindows,Messages,SysUtils,Classes,Graphics,Controls,F(xiàn)orms,Dialogs,ExtCtrls,Jpeg,ComCtrls;typeTSerialInstallForm=class(TForm)  ImagelTImage;  TitleImageTImage;  Label1ImageTImage;  Label2ImageTImage;  Label3ImageTImage;  Ball1ImageTImage;  Ball2ImageTImage;  Ball3ImageTImage;  BallV1ImageTImage;  BallV2ImageTImage;  BallV3ImageTImage;  Big2ImageTImage;  Big3ImageTImage;  BiglImageTImage;  Animation1TAnimate;  Animation2TAnimate;  Animation3TAnimate;  NextImageTImage;  CutBackImageTImage;  CutNextImageTImage;  ErrorImageTImage;  ClipErrorImageTImage;  XErrorAnimateTAnimate;  OopsErrorAnimateTAnimate;  RetryErrorImageTImage;  ExitErrorImageTImage;  Label4ImageTImage;  Ball4ImageTImage;  HelpImageTImage;  ResetImageTImage;  procedureNextImageClick(SenderTObject);  procedureCutNextImageClick(SenderTObject);  procedureCutBackImageClick(SenderTObject);procedureFormCreate(SenderTObject);  procedureClipErrorImageClick(SenderTObject);  procedureExitErrorImageClick(SenderTObject);  procedureRetryErrorImageClick(SenderTObject);private  {Privatedeclarations}public  {Publicdeclarations}  SectionInteger;  procedureShowSection(ValueInteger);end;var  SerialInstallFormTSerialInstallForm;implementationusesInstallation,ToyInstall,ToySetup;{SR*DFM}procedureTSerialInstallForm.NextImageClick(SenderTObject);begin  ShowSection(2);  Section=2;end;procedureTSerialInstallForm.CutNextImageClick(SenderTObject);varHubAckinteger;beginSection=Section+1;ifSection=5then  begin  HubAck=MainInstallForm.Xmidil.HubReset(8*16+2);  ifHubAck<>1then  begin  sleep(200);  HubAck=MainInstallForm.Xmdil.HubReset(8*16+2);  end;  ifHubAck=1then  beginHide;  ToySetupForm.WindowState=wsMaximized;  ToySetupForm.Show;  ToySetupForm.Section=1;  ToySetupForm.ShowSection(1);  end  else  begin  Section=5;  ShowSection(Section);  end;  end  else  ShowSection(Section);end;procedureTSerialInstallForm.CutBackImageClick(SenderTObject);begin  Section=Section-1;  ShowSection(Section);end;procedureTSerialInstallForm.ShowSection(ValueInteger);begincaseValueof1begin  Label1Image.Visible=True;  Label2Image.Visible=False;  Label3Image.Visible=False;  Label4Image.Visible=False;  Ball1Image.Visible=True;  Ball2Image.Visible=False;  Ball3Image.Visible=False;  Ball4Image.Visible=False;  BallV1Image.Visible=False;  BallV2Image.Visible=False;  BallV3Image.Visible=False;  BigllImage.Visible=True;  Big2Image.Visible=False;  Big3Image.Visible=False;  Animationl.Visible=True;  Animation2.Visible=False;  Animation3.Visible=False;NextImage.Visible=True;  CutBackImage.Visible=False;  CutNextImage.Visible=False;  ErrorImage.Visible=False;  ClipErrorImage.Visibla=False;  XErrorAnimate.Visible=False;  OopsErrorAnimate.Visible=False;  RetryErrorImage.Visible=False;  ExitErrorImage.Visible=False;  ResetImage.Visible=False;end;2begin  Label1Image.Visible=True;  Label2Image.Visible=True;  Label3Image.Visible=False;  Label4Image.Visible=False;  Ball1Image.Visible=False;  Ball2Image.Visible=True;  Ball3Image.Visible=False;  Ball4Image.Visible=False;  BallV1Image.Visible=True;  BallV2Image.Visible=False;  BallV3Image.Visible=False;  BiglImage.Visible=False;  Big2Image.Visible=True;  Big3Image.Visible=False;  Animationl.Visible=False;  Animation2.Visible=True;  Animation3.Visible=False;  NextImage.Visible=False;  CutBackImage.Visible=True;  CutNextImage.Visible=True;  ErrorImage.Visible=False;  ClipErrorImage.Visible=False;  XErrorAnimate.Visible=False;  OopsErrorAnimate.Visible=False;  RetryErrorImage.Visible=False;  ExitErrorImage.Visible=False;  ResetImage.Visible=False;end;3beginLabel1Image.Visible=True;  Label2Image.Visible=True;  Label3Image.Visible=True;  Label4Image.Visible=False;  Ball1Image.Visible=False;  Ball2Image.Visible=False;  Ball3Image.Visible=True;  Ball4Image.Visible=False;  BallV1Image.Visible=True;  BallV2Image.Visible=True;  BallV3Image.Visible=False;  Big1Image.Visible=False;  Big2Image.Visible=False;  Big3Image.Visible=True;  Animationl.Visible=False;  Animation2.Visible=False;  Animation3.Visible=True;  NextImage.Visible=False;  CutBackImage.Visible=True;  CutNextImage.Visible=True;  ErrorImage.Visible=False;  ClipErrorImage.Visible=False;  XErrorAnimate.Visible=False;  OopsErrorAnimate.Visible=False;  RetryErrorImage.Visible=False;  ExitErrorImage.Visible=False;  ResetImage.Visible=False;end;4begin  Label1Image.Visible=True;  Label2Image.Visible=True;  Label3Image.Visible=True;  Label4Image.Visible=True;  Ball1Image.Visible=False;  Bal12Image.Visible=False;  Ball3Image.Visible=False;  Ball4Image.Visible=True;  BallV1Image.Visible=True;  BallV2Image.Visible=True;  BallV3Image.Visible=True;  Big1Image.Visible=True;  Big2Image.Visible=False;Big3Image.Visible=False;  Animation1.Visibie=True;  Animation2.Visible=False;  Animation3.Visible=False;  NextImage.Visible=False;  CutBackImage.Visible=True;  CutNextImage.Visible=True;  ErrorImage.Visible=False;  ClipErrorImage.Visible=False;  XErrorAnimate.Visible=False;  OopsErrorAnimate.Visible=False;  RetryErrorImage.Visible=False;  ExitErrorImage.Visible=False;  ResetImage.Visible=True;end;5begin  Label1Image.Visible=True;  Label2Image.Visible=True;  Label3Image.Visible=True;  Label4Image.VisIble=True;  Ball1Image.Visible=False;  Ball2Image.Visible=False;  Ball3Image.Visible=False;  Ball4Image.Visible=True;  BallV1Image.Visible=True;  BallV2Image.Visible=True;  BallV3Image.Visible=True;  Big1Image.Visible=False;  Big2Image.Visible=False;  Big3Image.Visible=False;  Animation1.Visible=False;  Animation2.Visible=False;  Animation3.Visible=False;  NextImage.Visible=False;  CutBackImage.Visible=False;  CutNextImage.Visible=False;  ErrorImage.Visible=True;  ClipErrorImage.Visible=True;  XErrorAnimate.Visible=False;  OopsErrorAnimate.Visible=True;  RetryErrorImage.Visible=True;  ExitErrorImage.Visible=True;ResetImage.Visible=False;  end;end;end;procedureTSerialInstallForm.FormCreate(SenderTObject);beginWithBall1Imagedo  begin  Left=30;  Top=200;  Height=35;  Width=33;  end;WithBallV1Imagedo  begin  Left=30;  Top=197;  Height=38;  Width=35;  end;WithBall2Imagedo  begin  Left=31;  Top=269;  Height=35;  Width=33;  end;WithBallV2Imagedo  begin  Left=31;  Top=266;  Height=38;  Width=38;  end;WithBall3Imagedo  begin  Left=59;Top=352;  Height=35;  Width=33;end;WithBailV3Imagedobegin  Left=59;  Top=343;  Height=38;  Width=38;end;WithBall4Imagedobegin  Left=82;  Top=422;  Height=35;  Width=33;end;WithNextImagedobegin  Left=479;  Top=430;  Height=74;  Width=220;end;WithCutBackImagedobegin  Left=483;  Top=429;  Height=77;  Width=108;end;WithCutNextImagedobegin  Left=590;  Top=429;  Height=77;  Width=108;end;WithBiglImagedobegin  Left=393;  Top=34;  Height=359;  Width=328;end;WithBig2Imagedobegin  Left=393;  Top=34;  Height=319;  Width=352;end;WithBig3Imagedobegin  Left=393;  Top=34;  Height=326;  Width=352;end;WithAninationldobegin  FileName=MainInstallForm.GraphicsPath+′InstallHUB.Avi′;  Active=True;  Left=593;  Top=294;  Height=40;  Width=32;end;WithAnimation2dobegin  FileName=MainInstallForm.GraphicsPath+′Hubin.Avi′;  Active=True;  Left=503;  Top=226;  Height=60;Width=128;end;WithAnimaticn3dobegin  FileName=MainInstallForm.GraphicsPath+′Electricin.Avi′;  Active=True;  Left=505;  Top=113;  Height=150;  Width=80;end;WithXErtorAnimatedobegin  FileName=MainInstallForm.GraphicsPath+′XOnHUB.Avi′;  Active=True;  Left=418;  Top=158;  Height=100;  Width=112;end;WithOopsErrorAnimatedobegin  FileName=MainInstallForm.GraphicsPath+′Oops.Avi′;  Active=True;  Left=539;  Top=81;  Height=50;  Width=96;end;WithErrorImagedobegin  Left=405;  Top=140;  Height=125;  Width=362;end;WithRetryErrorImagedobeginLeft=301;  Top=296;  Height=55;  Width=89;  end;WithExitErrorImagedo  begin  Left=589;  Top=296;  Height=55;  Width=92;  end;WithClipErrorImagedo  begin  Left=488;  Top=433;  Height=68;  Width=201;  end;WithResetImagedo  begin  Left=580;  Top=175;  Height=86;  Width=171;  end;end;procedureTSerialInstallForm.ClipErrorImageClick(SenderTObject);begin//  Section=1;  ShowSection(Section);end;procedureTSerialInstallForm.ExitErrorImageClick(SenderTObject);begin  close;  MainInstallForm.Close;end;procedureTSerialInstallForm.RetryErrorImageClick(SenderTObject);begin//Section=Section-1;CutNextImageClick(mil);end;end.unitToyInstall;interfaceusesWindows,Messages,SysUtils,Classes,Graphics,Controls,F(xiàn)orms,Dialogs,Jpeg,ExtCtrls,CcmCtrls;typeTToyInstallForm=class(TForm)  ImagelTImage;  Step1ImageTImage;  Step2ImageTImage;  Step3ImageTImage;  BigStep1ImageTImage;  BigStep2ImageTImage;  BigStep3ImageTImage;  Step1AnimateTAnimate;  NextButtonImageTImage;  DoneButtonImageTImage;  Step3BackImageTImage;  Step2NextImageTImage;  Step2BackImageTImage;  procedureNextButtonImageClick(SenderTObject);  procedureDoneButtonImageClick(SenderTObject);  procedureFormCreate(SenderTObject);  procedureStep2BackImageClick(SenderTObject);  procedureStep2NextImageClick(SenderTObject);  procedureStep3BackImageClick(SenderTObject);private  {Privatedeclaratioms}public  {Publicdeclarations}  SectionInteger;  procedureShowSection(ValueInteger);end;varToyInstallFormTToyInstallForm;implementationusesInstallation;{SR*.DFM)procedureTToyInstallForm.NextButtonImageClick(SenderTObject);beginSection=2;ShowSection(Section);end;procedureTToyInstallForm.DoneButtonImageClick(SenderTObject);begin  Close;  MainInstallForm.close;end;procedureTToyInstallForm.FormCreate(SenderTObject);begin//WithStep1Imagedo  begin  Left=46;  Top=128;  Height=224;  Width=275;  end;WithStep2Imagedo  begin  Left=48;  Top=233;  Height=108;  Width=180;  end;WithStep3Imagedo  begin  Left=39;  Top=135;  Height=140;  Width=308;  endWithBigSteplImagedobegin  Left=405;  Top=48;  Height=354;  Width=360;end;WithBigStep2Imagedobegin  Left=416;  Top=61;  Height=341;  Width=335;end;WithBigStep3Imagedobegin  Left=419;  Top=53;  Height=343;  Width=326;end;WithNextButtonImagedobegin  Left=478;  Top=430;  Height=74;  Width=223;end;WithDoneButtonImagedobegin  Left=589;  Top=433;  Height=69;  Width=105;end;WithStep2BackImagedobegin  Left=479;Top=429;  Height=77;  Width=110;  end;WithStep2NextImagedo  begin  Left=589;  Top=429;  Height=77;  Width=111;  end;WithStep3BackImagedo  begin  Left=479;  Top=429;  Height=77;  Width=110;  end;WithStep1Animatedo  begin  FileName=MainInstallForm.GraphicsPath+′DollFaceMove.Avi′;  Active=True;  Left=539;  Top=119;  Height=80;  Width=80;  end;end;procedureTToyInstallForm.ShowSection(ValueInteger);begincaseValueof1begin  SteplImage.Visible=True;  Step2Image.Visible=False;  Step3Image.Visible=False;  BlgStep1Image.Visible=True;  BigStep2Image.Visible=False;  BigStep3Image.Visible=False;  SteplAnimate.Visible=True;NextButtonImage.Visibie=True;  DoneButtonImage.Visible=False;  Step3BackImage.Visible=False;  Step2NextImage.Visible=False;  Step2BackImage.Visible=False;  end;2begin  Step1Image.Visible=True;  Step2Image.Visible=True;  Step3Image.Visible=False;  BigStep1Image.Visible=False;  BigStep2Image.Visible=true;  BigStep3Image.Visible=False;  Step1Animate.Visible=False;  NextButtonImage.Visible=False;  DoneButtonImage.Visible=False;  Step3BackImage.Visible=False;  Step2NextImage.Visible=True;  Step2BackImage.Visible=True;  end;3begin  Step1Image.Visible=False;  Step2Image.Visible=False;  Step3Image.Visible=True;  BigStep1Image.Visible=False;  BigStep2Image.Visible=False;  BigStep3Image.Visible=True;  Step1Animate.Visible=False;  NextButtonImage.Visible=False;  OoneButtonImage.Visible=True;  Step3BackImage.Visible=True;  Step2NextImage.Visible=False;  Step2BackImage.Visible=False;  end;endend;procedureTToyInstallForm.Step2BackImageClick(SenderTObject);begin  Section=1;  ShowSection(Section)end;procedureTToyInstallForm.Step2NextImageClick(SenderTObject);beginSection=3;ShowSection(Section);end;procedureTToyInstallForm.Step3BackImageClick(SenderTObject);beginSection=2;ShowSection(Section);end;end.unitToySetup;interfaceusesWindows,Messages,SysUtils,Classes,Graphics,Controls,F(xiàn)orms,Dialogs,ExtCtrls,ComCtrls,Menus;typeTToySetupForm=class(TForm)  ImagelTImage;  Title1ImageTImage;  Title3ImageTImage;  Title2ImageTImge;  AnimatelTAnimate;  HelpImageTImage;  Big1ImageTImage;  NextImageTImage;  ErrorImageTImage;  TextErrorImageTImage;  ConfirmImageTImage;  CheckImageTImage;  CutNextImageTImage;  CutRetryImageTImage;  Big2ImageTImge;  Big3ImageTImge;  ExitImageTImage;  MainMenulTMainMenu;  testlTMenuItem;  escapelTMenuItem;  procedureFormCreate(SenderTObject);  procedureNextImageClick(SenderTObject);  procedureCutNextImageClick(SenderTObject);  procedureCutRetryImageClick(SenderTObject);  procedureCheckImageClick(SenderTObject);  procedureExitImageClick(SenderTObject);  procedureescapelClick(SenderTObject);private  {Privatedeclarations)public  {Publicdeclaretions}  SectionInteger;  procedureShowSection(ValueInteger);functionToyTalkinteger;end;varToySetupFormTToySetupForm;implementationusesInstallation;{SR*.DFM}procedureTToySetupForm.FormCreate(SenderTObject);begin//WithTitle1Imagedo  begin  Left=48;  Top=136;  Height=152;  Width=306;  end;WithTitle2Imagedo  begin  Left=57;  Top=124;  Height=236;  Width=331;  end;WithTitle3Imagedo  begin  Left=33;  Top=125;  Height=273;  Width=392;  end;WithBig1Imagedo  begin  Left=419;Top=52;  Height=343;  Width=326;end;WithBig2Imagedobegin  Left=393;  Top=34;  Height=378;  Width=364;end;WithBig3Imagedobegin  Left=411;  Top=51;  Height=337;  Width=342;end;WithNextImagedobegin  Left=478;  Top=430;  Height=74;  Width=223;end;WithCheckImagedobegin  Left=477;  Top=434;  Height=66;  Width=228;end;WithCutNextImagedobegin  Left=478;  Top=435;  Height=66;  Width=110;end;WithCutRetryImagedobegin  Left=588;  Top=435;  Height=66;  Width=115;end;WithErrorImagedobegin  Left=432;  Top=120;  Height=184;  Width=320;end;WithTextErrorImagedobegin  Left=36;  Top=243;  Height=152;  Width=371;end;WithConfirmImagedobegin  Left=411;  Top=148;  Height=187;  Width=353;end;WithAnimateldobegin  FileName=MainInstallForm.GraphicsPath+′oops,Avi′;  Active=True;  Left=534;  Top=64;  Height=50;  Width=96;end;end;procedureTToySetupForm.ShowSecrtion(ValueInteger);begincaseValueof1begin//step1  Titie1Image.Visible=True;  Title2Image.Visible=False;  Title3Image.Visible=False;  Big1Image.Visible=True;  Big2Image.Visible=False;  Big3Image.Visible=False;  ErrorImage.Visible=False;  TextErrorImage.Visible=False;  ConfirmImage.Visible=False;  Animatel.Visible=False;  NextImage.Visible=True;  CheckImage.Visible=False;  CutNextImage.Visible=False;  CutRetryImage.Visible=False;  end;2begin//step2  Title1Image.Visible=False;  itle2Image.Visible=True;  Title3Image.Visible=False;  Big1Image.Visible=False;  Big2Image.Visible=True;  Big3Image.Visible=False;  ErrorImage.Visible=False;  TextErrorImage.Visible=False;  ConfirmImage.Visible=False;  Animatel.Visible=False;  NextImage.Visible=False;  CheckImage.Visible=False;  CutNextImage.Visible=True;  CutRetryImage.Visible=True;  end;3begin//step3  Title1Image.Visible=False;  Title2Image.Visible=False;  Title3Image.Visible=True;Big1Image.Visible=False;  Big2Image.Visible=False;  Big3Image.Visible=True;  ErrorImage.Visible=False;  TextErrorImage.Visible=False;  ConfirmImage.Visible=False;  Animatel.Visible=False;  NextImage.Visible=False;  CheckImage.Visible=True;  CutNextImage.Visible=False;  CutRetryImage.Visible=False;  end;4begin//Confirm  Title1Image.Visible=False;  Title2Image.Visible=False;  Title3Image.Visible=False;  Big1Image.Visible=False;  Big2Image.Visible=False;  Big3Image.Visible=False;  ErrorImage.Visible=False;  TextErrorImage.Visible=False;  ConfirmImage.Visible=True;  Animatel.Visible=False;  NextImage.Visible=True;  CheckImage.Visible=False;  CutNextImage.Visible=False;  CutRetryImage.Visible=False;  end;10begin//Error  Title1Image.Visible=False;  Title2Image.Visible=False;  Title3Image.Visible=False;  Big1Image.Visible=False;  Big2Image.Visible=False;  Big3Image.Visible=False;  ErrorImage.Visible=True;  TextErrorImage.Visible=True;  ConfirmImage.Visible=False;  Animatel.Visible=True;  NextImage.Visible=True;  CheckImage.Visible=False;CutNextImage.Visibie=False;  CutRetryImage.Visibie=False;  end;end;end;procedureTToySecupForm.NextImageClick(SenderTObject);begin//NextSection=Section+1;ShowSection(Section);ifSection=5then  begin  Hide;  MainInstallForm.Close;  end;end;procedureTToySetupForm.CutNextImageClick(SenderTObject);begin//CutNext  Section=Section+1;  ShowSection(Section);  ifSection=5then  begin  Hide;  MainInstallForm.Close;  end;end;procedureTToySetupForm.CutRetryImageClick(SenderTObject);begin//CutRetryend;procedureTToySetupForm.CheckImageClick(SenderTObject);begin//CheckifToyTalk=1thenbegin  CheckImage.Visible=False;  CutNextImage.Visible=True;  CutRetryImage.Visible=True;  end  else  begin  ShowSection(10);  Section=2;  end;functionTToySetupForm.ToyTalkinteger;varToyNoInteger;begin//ToyTalk  ToyNo=MainInstallForm.PDBEngine.ToyNumber;  if(ToyNo>0)and(ToyNo<32)then  Result=MainInstallForm.XMidil.NewToyTalk(ToyNo,  MainInstallForm.AudioPath+′Install.wav′,0,0,0)  else  ifToyNo>31thenResult=MainInstallForm.XMidil.ToyTalk2(ToyNo,  MainInstallForm.AudioPath+′Install.wav′,0,0,0,0);end;procedureTToySetupForm.ExrtImageClick(SenderTObject);begin//hide;MainInstallForm.close;end;procedureTToySetupForm.escapelClick(SenderTCbject);begin//hide;MainInstallForm.close;end;end.]]></pre>玩具構(gòu)成源代碼<prelisting-type="program-listing"xml:space="preserve"><![CDATA[programPESTOConriguration;usesForms,Cofigurationin′Cofiguration.pas′(ConfigurationForm),PDBEnginein′PDBEngine.pas′;(SR*.RES)beginApplication.Initialize;Application.CreateForm(TConfigurationForm,ConfigurationForm);Application.Run;end.unitCofiguration;interfaceusesWindows,Messages,SysUtils,Classes,Graphics,Controls,F(xiàn)orms,Dialogs,Buttons,StdCtrls,Spin,PDBEngine,ComCtrls,ExtCtrls,NEWSRLib_TLB,OleCtrls,XMIDILib_TLB;typeTConfigurationForm=class(TForm)  SpeedButtonlTSpeedButton;  GroupBox1TGroupBox;  GroupBox2TGroupBox;  GroupBox3TGroupBox;  ButtonlTButton;  ComboBox1TComboBox;  ComboBox2TComboBox;  ComboBox3TComboBox;  MasterToySpinEditTSpinEdit;  Toy1SpinEditTSpinEdit;  Toy2SpinEditTSpinEdit;  MasterToyLabelTLabel;  Toy1LabelTLabel;  Toy2LabelTLabel;  Labe16TLabel;  Label7TLabel;  Label8TLabel;  PanellTPanel;  TrackBar4TTrackBar;  TrackBar5TTrackBar;  SpeedButton2TSpeedButton;  SpeedButton3TSpeedButton; SpeedButton4TSpeedButton;  TitleLabelTLabel;  GainlLabelTLabel;  VolumelLabelTLabel;  SpeedButton5TSpeedButton;  SpeedButton6TSpeedButton;  Buttcn2TButton;  Button3TButton;  XMidilTXMidi;  SR1TSR;Gain2LabelTLabel;  Volume2LabelTLabel;  procedureSpeedButtcnlClickSenderTObject);  procedureFormCreate(SenderTObject);  procedureFormClose(SenderTObject;varActionTCloseAction);  procedureSpeedButton2Click(SenderTObject);  procedureSpeedButton3Click(SenderTObject);  procedureSpeedButton4Click(SenderTObject);  procedureSpeedButton5Click(SenderTObject);  procedureSpeedButton6Click(SenderTObject);  procedureButtonlClick(SenderTObject);  procedureComboBox1Change(SenderTObject);  procedureComboBox2Change(SenderTObject);  procedureComboBox3Change(SenderTObject);  procedureMasterToySpinEditChange(SenderTObject);  procedureToy1SpinEditChange(SenderTObject);  procedureToy2SpinEditChange(SenderTObject);  procedureButton2Click(SenderTObject);  procedureButton3Click(SenderTObject);private  {Privatedeclarations}public  {Publicdeclarations}  DataBaseEngineTPDBEngine;  Currentpathstring;  CreatorPathstring;  DatabasePathstring;  GraphicsPathstring;  AudioPathstring;  UsagePathstring;  PresentationPathstring;  functionGetCurrentPath(CurrentExeNamestring)string;  functionToyTalk(ToyNoInteger;TalkFilesstring;  LTimeInteger)Integer;  functionToyListen(Mapstring;DelayTimeReal)Integer;  functionConvertToyNameToNumber(valuestring)Integer;  procedureFillLabels(valuestring);  functionConvertToyNumberToName(valueInteger)string;end;varConfigurationFormTConfigurationForm;constToyName1=′TeddyBear′;ToyName2=′Frog′;ToyName3=′Storyteller1[21H]′;ToyName4=′Storyteller2[22H]′;ToyName5=′Storyteller3[23H]′;ToyGain1=′Microphone′;ToyGain2=′Sensitivity′;ToyVolume1=′Volume′;ToyVolume2=′′;HubGain1=′ToysVolume′;HubGain2=′′;HubVolume1=′Microphone′;HubVolume2=′Level′;implementation{SR*.DFM}procedureTConfigurationForm.SpeedButtonlClick(SenderTObject);begin//try  DataBaseEngine.ToyNumber=MasterToySpinEdit.Value;  DataBaseEngine.SaveConfiguration;exceptend;Close;end;procedureTConfigurationForm.FormCreate(SenderTObject);vartempinteger;begin//FillPathes  CurrentPath=GetCurrentPath(Application.ExeName);  CreatorPath=Copy(CurrentPath,l,Length(CurrentPath)-Length(′Executables\′)};  DatabasePath=CreatorPath+′PESTO\DATABASE\′;  GraphicsPath=CreatorPath+′PESTO\GRAPHICS\′;  AudioPath=CreatorPath+′PESTO\AUDIO\′;  UsagePath=CreatorPath+′PESTO\USAGE\′;PresentationPath=AudioPath+′PRESENTATION\′;//try  DataBaseEngine=TPDBEngine.create(self);  DataBaseEngine.DataBasePath=DatabasePath;  DataBaseEngine.LoadConfiguration;  MasterToySpinEdit.Value=DataBaseEngine.ToyNumber;  ComboBox1.Text=ConvertToyNumberToName(MasterToYSpinEdit.Value);exceptend;  Width=319;  Height=407;  SRl.Init;  Xmidil.StartHUB;  ComboBox1.Items.Add(ToyName1);  ComboBox1.Items.Add(ToyName2);  ComboBox1.Items.Add(ToyName3);  ComboBox1.Items.Add(ToyName4);  ComboBox1.Items.Add(ToyName5);  ComboBox2.Items.Add(ToyName1);  ComboBox2.Items.Add(ToyName2);  ComboBox2.Items.Add(ToyName3);  ComboBox2.Items.Add(ToyName4);  ComboBox2.Items.Add(ToyName5);  ComboBox3.Items.Add(ToyName1);  ComboBox3.Items.Add(Toyame2);  ComboBox3.Items.Add(ToyName3);  ComboBox3.Items.Add(ToyName4);  ComboBox3.Items.Add(ToyName5);end;functionTConfigurationForm.GetCurrentPath(CurrentExeNamestring)string;variinteger;begini=Length(CurrentExeName);Whilei>0dobegin  ifCopy(CurrentExeName,i,1)=′\′theni=0  else  begin  i=i-1;  CurrentExeName=Copy(CurrentExeName,1,i);  end;  end;  Result=CurrentExeName;end;procedureTConfigurationForm.FormClose(SenderTObject;varActionTCloseAction);begin//DataBaseEngine.Free;srl.Close;Xmidil.StopHUB;end;procedureTConfigurationForm.SpeedButton2Click(SenderTObject);beginFillLabels(′TOY′);TitleLabel.Caption=′MasterToy′;width=631;end;procedureTConfigurationForm.SpeedButton3Click(SenderTObject);beginFillLabels(′TOY′);TitleLabel.Caption=′Toyl′;width=631;end;procedureTConfigurationForm.SpeedButton4Click(SenderTObject);beginFillLabels(′TOY′);TitleLabel.Caption=′Toy2′;width=631;end;procedureTConfigurationForm.SpeedButtonSClick(SenderTCbject);beginwidth=319;end;procedureTConfigurationForm.SpeedButton6Click(SenderTObject);beginwidth=319;end;procedureTConfigurationForm.ButtonlClick(SenderTCbject);beginclose;end;procedureTConfigurationForm.ComboBox1Change(SenderTObject);beginMasterToySpinEdit.value=ConvertToyNameToNumber(ComboBoxl.Text);end;procedureTConfigurationForm.ComboBox2Change(SenderTObject);beginToylSpinEdit.value=ConvertToyNameToNumer(ComboBox2.Text);end;procedureTConfigurationForm.ComboBox3Change(SenderTObject);beginToy2SpinEdit.value=ConvertToyNameToNumer(ComboBox3.Text);end;procedureTConfigurationForm.MasterToySpinEditChange(SenderTObject);begintryMasterToyLabel.Caption=copy(IntToHex(MasterToySpinEdit.Value,2),length(IntToHex(MasterToySpinEdit.Value,2))-1,2);exceptend;end;procedureTConfigurationForm.ToylSpinEditChange(SenderTObject);begintryToylLabel.Caption=copy(IntToHex(ToyiSpinEdit.Value,2),  length(IntToHex(ToylSpinEdit.Value,2))-1,2);exceptend;end;procedureTConfigurationForm.Toy2SpinEditChange(SenderTObject);begintry  Toy2Label.Caption=copy(IntToHex(Toy2SpinEdit.Value,2),  length(IntToHex(Toy2SpinEdit.Value,2))-1,2);exceptend;end;procedureTConfigurationForm.Button2Click(SenderTObject);beginFillLabels(′HUB′);TitleLabel.Caption=′HUB′;width=631;end;procedureTConfigurationForm.Button3Click(SenderTObject);varAnswerInteger;begin//TestScript  ToyTalk(MasterToySpinEdit.Value,PresentationPath+′b8001.wav′,0);  ToyTalk(Toy1SpinEdit.Value,PresentationPath+′b8002.wav′,0);  ToyTalk(Toy2SpinEdit.Value,PresentationPath+′b8003.wav′,0);  ToyTalk(MasterToySpinEdit.Value,PresentationPath+′gm945.wav′,50);  Answer=ToyListen(′story/1,song/2′,S);  ifAnswer=1thenToyTalk(MasterToySpinEdit.Value,PresentationPath+′stm125.wav′,0);  ifAnswer=2thenToyTalk(MasterToySpinEdit.Value,PresentationPath+′sng320.wav′,0);end;functionTConfigurationForm.ToyTalk(ToyNoInteger;TalkFilesstring;  LTimeInteger)Integer;beginsleep(200);if(ToyNo>31)and(ToyNo<>85)then  begin  Result=XMidil.ToyTalk2(ToyNo,TalkFiles,0,LTime,0,0);ifResult<0thenResult=XMidil.ToyTaik2(ToyNo,TalkFiles,0,LTime,0,0);  end;  if((ToyNo<32>and(ToyNo>0))or(ToyNo=85)then  begin  Result=XMidil.NewToyTalk(ToyNo,TalkFiles,0,9,LTime);  ifResult<0thenResult=XMidil.NewTovTalk(ToyNo,TalkFiles,0,9,LTime);  end;sleep(100);end;functionTConfigurationForm.ToyListen(Mapstring;DelayTimeReal)Integer;varDTimeInteger;FlagsInteger;begin  DTime=Trunc(DelayTime*10);  Flags=1;  Result=srl.WaitForEvent(Map,DTime,F(xiàn)lags);  if(Result>0)and(srl.GetPhraseConfLevel(1)<5000)thenResult=0;end;functionTConfigurationForm.ConvertToyNameToNumber(valuestring)Integer;beginifToyNamel=valuethenResult=1;ifToyName2=valuethenResult=2;ifToyName3=valuethenResult=33;ifToyName4=valuethenResult=34;ifToyName5=valuethenResult=35;end;functionTConfigurationForm.ConvertToyNumberToName(valueInteger)string;beginifvalue=1thenResult=ToyName1;ifvalue=2thenResult=ToyName2;ifvalue=33thenResult=ToyName3;ifvalue=34thenResult=ToyName4;ifvalue=35thenResult=ToyName5;end;procedureTConfigurationForm.FillLabels(valuestring);beginifvalue=′HUB′thenbegin  Gain1Label.caption=HubGain1;  Gain2Label.caption=HubGain2;  Volume1Label.caption=HubVolume1;  Volume2Label.caption=HubVolume2;end;ifvalue=′TOY′thenbegin  Gain1Label.caption=ToyGain1;  Gain2Label.caption=ToyGain2;  Volume1Label.caption=ToyVolume1;  Volume2Label.caption=ToyVolume2;end;end;end.]]></pre>附錄BRS232BaseRevisedMondayApril13,1998001Revieion001BillOfMaterialsApril13,1998152618Page1ItemQuantityReferencePart13C1,C35,C3610nF25C2,C28,C33,C40,C471.0nF39C3,C5,C21,C25,C29,C341.0uFC38,C42,C4541C410uF54C6,C7,C14,C15,C160.47uF61C80.15uF72C9,C173.3uF81C1033pF92C11,C43220pF109C12,C18,C22,C23,C30,C41,0.1uFC48,C50,C52111C1347nF121C1915pF131C2010pF142C24,C27100nF151C262.2uF162C32,C3122pF171C3768nF181C3922nF191C4468pF201C46560pF211C49100uF221C5110uF/16V231D1RED244D2,D3,D4,D51N4148252JP2,JP1JUMPER261J1Antenna271J2CON28C281P1RS232292Q2,Q12N2222302Q3,Q52N2907312Q4,Q6BC5473215R1,R2,R4,R6,R9,R10,R12,47KR15,R16,R17,R55,R56,R57,R58,R59331R38.2K341R547351R63.9369R7,R29,R32,R45,R53,R62,1KR65,R70,R72372R11,R1427K381R13680K399R18,R19,R20,R21,R23,R26,100KR36,R39,R54401R2233K411R24510423R25,R43,R7410432R27,R6610K441R28200K451R30220461R31470473R33,R61,R68100481R3450491R3551K501R385.1K522R42,R40500531R417/5K542R50,R44121K552R48,R46165K561R4750K571R49140K581R51107K591R52120K60R60,R63,R67,R72,R732.7K61R64,R693K62S1Reset63U1MC1311164U24053PR65U3,U674HC57466U4PIC16C73Microchip67U5626468U7TL07469U8RY3GB021-900MHzSharp70Y110.240MHz71Y214.7456MHz附錄CTOY900MHZPRODUCTRevisedMonday,April30,1998Revision1.1BillOfMaterialsApril13,1998153128Page1ItemQuantityReferencePart11C16.9uF22C2,C427pF31C32.2uF412C5,C6,C7,C9,C20,C24,C25,.01uFC27,C30,C41,C46,C4851C8100uF/16V64C10,C33,C34,C3710nF71C111nF83C12,C15,C441uF94C13,C35,C36,C3810uF105C14,C21,C23,C26,C320.47uF111C163.3uF121C17150nF131C1833pF141C19220pF151C216.8pF161C2815pF172C45,C2910pF181C3168nF191C39680nF201C4047pF211C42470nF231D11N1448245D2,D3,D4,D5,D61N4148251J1POWER261J2ANT1271J3MOTORCON281J4MIC293L1,L2,L356uHN302Q5,Q12N29073133Q2,Q6,Q72N2222322Q4,Q32SD1834331RS1750342RTC1,R48470K351R13.3K3616R2,R3,R4,R5,R17,R79,R35,100KR35,R40,R41,R43,R49,R50,R51,R60371R610K384R7,R8,R11,E3951K391R9130K401R1010M412R24,R1247426R13,R14,R45,R46,R47,R8910K431R152K442R16,R1822K4516R20,R21,R23,R26,R27,R28,47KR31,R34,R37,R38,R53,R54,R55,R56,R57,R58462R22,R428.2K471R243.9K482R29,R3327K491R301.0K501R32680K511R44470521U1MC69HC05P3531U2MAX485541U3MC13111551U4TL074561U514521571U6RY3GB05-900mhZ-Sharp581U7LM4861591Y14MHZ601Y210.240MHZ611EXTRACAP47Nf本領(lǐng)域的熟練技術(shù)人員可以理解本發(fā)明并不限于以上具體示出和描述的。本發(fā)明的范圍僅由以下的權(quán)利要求限定。權(quán)利要求1.一種交互式玩具設(shè)備,包括具有有趣的物理外觀的玩具;安裝在該玩具上的揚聲器;用戶輸入接收器;存儲有關(guān)至少一用戶的信息的用戶信息存儲單元;和內(nèi)容控制器,其響應(yīng)于經(jīng)該用戶輸入接收器接收的當前用戶輸入和該存儲單元中存儲的信息進行工作,經(jīng)該揚聲器提供音頻內(nèi)容給該用戶。2.根據(jù)權(quán)利要求1的交互式玩具設(shè)備,其中該用戶輸入接收器包括一音頻接收器。3.根據(jù)權(quán)利要求2的交互式玩具設(shè)備,其中該當前用戶輸入包括經(jīng)該音頻接收器接收的一言語輸入。4.根據(jù)權(quán)利要求1的交互式玩具設(shè)備,其中該用戶輸入接收器包括一觸覺輸入接收器。5.根據(jù)權(quán)利要求1的交互式玩具設(shè)備,其中該存儲單元存儲有關(guān)至少一用戶的個人信息且該內(nèi)容控制器進行工作以使該音頻內(nèi)容人性化。6.根據(jù)權(quán)利要求1的交互式玩具設(shè)備,其中該存儲單元存儲有關(guān)至少一用戶與該交互式玩具設(shè)備的交互的信息且該內(nèi)容控制器進行工作以根據(jù)存儲的有關(guān)該至少一用戶與該交互式玩具設(shè)備的過去的交互的信息來控制該音頻內(nèi)容。7.根據(jù)權(quán)利要求5的交互式玩具設(shè)備,其中該存儲單元還存儲有關(guān)至少一用戶與該交互式玩具設(shè)備的交互的信息且該內(nèi)容控制器還進行工作以根據(jù)有關(guān)該至少一用戶與該交互式玩具設(shè)備的過去的交互的信息來控制該音頻內(nèi)容。8.根據(jù)權(quán)利要求1的交互式玩具設(shè)備,其中該存儲單元還存儲由一用戶經(jīng)該用戶輸入接收器言語地輸入的信息。9.根據(jù)權(quán)利要求5的交互式玩具設(shè)備,其中該存儲單元還存儲由一用戶經(jīng)該用戶輸入接收器言語地輸入的信息。10.根據(jù)權(quán)利要求7的交互式玩具設(shè)備,其中該存儲單元還存儲由一用戶經(jīng)該用戶輸入接收器言語地輸入的信息。11.根據(jù)權(quán)利要求1的交互式玩具設(shè)備,還包括一內(nèi)容存儲單元,存儲經(jīng)該揚聲器待被播送給一用戶的至少一內(nèi)容標題的的音頻內(nèi)容,該至少一內(nèi)容標題是交互式的且包含交互分支。12.根據(jù)權(quán)利要求11的交互式玩具設(shè)備,其中該至少一內(nèi)容標題包括存儲對應(yīng)的多個內(nèi)容標題部分的多個音頻文件,包括至少兩個可替換的內(nèi)容標題部分;和響應(yīng)于一任意的一用戶輸入、一環(huán)境條件、一過去的交互、有關(guān)一用戶的個人信息、一遠程計算機、和一與時間有關(guān)的條件在這些可替換的用戶部分之間的一文本定義分支。13.根據(jù)權(quán)利要求5的交互式玩具設(shè)備,還包括一內(nèi)容存儲單元,存儲經(jīng)該揚聲器待被播送給一用戶的至少一內(nèi)容標題的的音頻內(nèi)容,該至少一內(nèi)容標題是交互式的且包含交互分支。14.根據(jù)權(quán)利要求13的交互式玩具設(shè)備,其中該至少一內(nèi)容標題包括多個內(nèi)容元素的并行部分,該多個內(nèi)容元素的并行部分包括至少兩個可替換的部分,和在這些可替換的部分之間的以一人性化方式的一文本定義分支。15.根據(jù)權(quán)利要求1的交互式玩具設(shè)備,其中該用戶信息存儲單元被至少部分地定位在該玩具中。16.根據(jù)權(quán)利要求1的交互式玩具設(shè)備,其中該用戶信息存儲單元被至少部分地定位在該玩具外。17.根據(jù)權(quán)利要求1的交互式玩具設(shè)備,其中該內(nèi)容存儲單元被至少部分地定位在該玩具中。18.根據(jù)權(quán)利要求1的交互式玩具設(shè)備,其中該內(nèi)容存儲單元被至少部分地定位在該玩具外。19.根據(jù)權(quán)利要求1的交互式玩具設(shè)備,其中該用戶輸入接收器包括安裝在該玩具上的一麥克風;和接收自該麥克風輸入的一語句的一語音識別單元。20.根據(jù)權(quán)利要求5的交互式玩具設(shè)備,其中該用戶信息存儲單元進行工作以存儲有關(guān)各可用一唯一碼識別的多個用戶的個人信息且其中該內(nèi)容控制器進行工作以提醒任意用戶提供該用戶碼。21.根據(jù)權(quán)利要求5的交互式玩具設(shè)備,其中該用戶信息存儲單元進行工作以存儲有關(guān)一用戶的合作行為的信息。22.具有改變臉部表情的玩具設(shè)備,該玩具包括多特征化的臉部設(shè)備,包括多個可多位置的臉部特征;和一臉部表情控制單元,其進行工作以至少生成代表至少兩個對應(yīng)的臉部表情的多個臉部特征的位置的三種組合。23.根據(jù)權(quán)利要求22的設(shè)備,其中該臉部表情控制單元進行工作以使這些特征以不同的速率在多個位置之間變動,從而生成不同情緒的錯覺。24.根據(jù)權(quán)利要求22的設(shè)備,還包括一揚聲器裝置;存儲一音頻聲明的一音頻存儲器;和進行工作以通過該揚聲器裝置控制該音頻聲明的輸出的一音頻輸出單元,且其中該臉部表情控制單元進行工作以與該聲明的輸出同步地生成多個位置的組合。25.用于播放一交互式言語游戲的玩具設(shè)備,包括一玩具;安裝在該玩具上的一揚聲器裝置;安裝在該玩具上的一麥克風;接收自該麥克風輸入的一語句的一語音識別單元;和一音頻存儲單元,用于存儲通過該揚聲器裝置待被播放的多個言語游戲段;和在這些言語游戲段之間的一文本存儲定義交互分支。26.根據(jù)權(quán)利要求25的玩具設(shè)備,其中這些言語游戲段包括提醒一用戶生成對該言語游戲的一說出的輸入的至少一段。27.根據(jù)權(quán)利要求25的玩具設(shè)備,其中該至少一段包括兩或更多的言語串和一對該用戶的提醒以再現(xiàn)這些言語串之一。28.根據(jù)權(quán)利要求25的玩具設(shè)備,其中該至少一段包括一謎。29.根據(jù)權(quán)利要求25的玩具設(shè)備,其中這些言語串中的至少一個具有教育內(nèi)容。30.根據(jù)權(quán)利要求25的玩具設(shè)備,其中這些言語串中的至少一個包括有關(guān)在該游戲中的該用戶的行為的性質(zhì)對用戶的一個反饋。31.根據(jù)權(quán)利要求1的交互式玩具設(shè)備,還包括與該玩具一起裝配的包括多個可多位置的臉部特征的多特征化臉部設(shè)備;和一臉部表情控制單元,其進行工作以至少生成代表至少兩個對應(yīng)的臉部表情的多個臉部特征的位置的三種組合。32.根據(jù)權(quán)利要求31的交互式玩具設(shè)備,其中該臉部表情控制單元進行工作以使這些特征以不同的速率在多個位置之間變動,從而生成不同情緒的錯覺。33.根據(jù)權(quán)利要求31的交互式玩具設(shè)備,還包括存儲一音頻聲明的一音頻存儲器;和進行工作以通過該揚聲器裝置控制該音頻聲明的輸出的一音頻輸出單元,且其中該臉部表情控制單元進行工作以與該聲明的輸出同步地生成多個位置的組合。34.根據(jù)權(quán)利要求1的交互式玩具設(shè)備,還包括安裝在該玩具上的一麥克風;接收自該麥克風輸入的一語句的一語音識別單元;和一音頻存儲單元,用于存儲通過該揚聲器裝置待被播放的一言語游戲的多個言語游戲段;和在這些言語游戲段之間的一文本存儲定義交互分支。35.根據(jù)權(quán)利要求34的交互式玩具設(shè)備,其中這些言語游戲段包括提醒一用戶生成對該言語游戲的一說出的輸入的至少一段。36.根據(jù)權(quán)利要求34的交互式玩具設(shè)備,其中該至少一段包括兩或更多的言語串和一對該用戶的提醒以再現(xiàn)這些言語串之一。37.根據(jù)權(quán)利要求34的交互式玩具設(shè)備,其中該至少一段包括一謎。38.根據(jù)權(quán)利要求34的交互式玩具設(shè)備,其中這些言語串中的至少一個具有教育內(nèi)容。39.根據(jù)權(quán)利要求34的交互式玩具設(shè)備,其中這些言語串中的至少一個包括有關(guān)在該游戲中的該用戶的行為的性質(zhì)對用戶的一個反饋。40.一種玩具交互的方法,包括提供具有有趣的物理外觀的一玩具;提供安裝在該玩具上的一揚聲器;提供一用戶輸入接收器;將有關(guān)至少一用戶的信息存儲進一用戶信息存儲單元;經(jīng)一響應(yīng)于經(jīng)該用戶輸入接收器接收的當前用戶輸入和該存儲單元中存儲的信息進行工作的內(nèi)容控制器,經(jīng)該揚聲器提供音頻內(nèi)容給該用戶。41.根據(jù)權(quán)利要求40的方法,其中該存儲步驟包括存儲有關(guān)至少一用戶的個人信息并經(jīng)該內(nèi)容控制器使該音頻內(nèi)容人性化。42.根據(jù)權(quán)利要求40的方法,其中該存儲步驟包括存儲有關(guān)至少一用戶與該交互式玩具設(shè)備的交互的信息且根據(jù)存儲的有關(guān)該至少一用戶與該交互式玩具設(shè)備的過去的交互的信息經(jīng)該內(nèi)容控制器來控制該音頻內(nèi)容。43.根據(jù)權(quán)利要求40的方法,還包括在一內(nèi)容存儲單元中存儲經(jīng)該揚聲器待被播送給一用戶的至少一內(nèi)容標題的的音頻內(nèi)容,該至少一內(nèi)容標題是交互式的且包含交互分支。44.根據(jù)權(quán)利要求40的方法,還包括存儲有關(guān)各可用一唯一碼識別的多個用戶的個人信息且經(jīng)該內(nèi)容控制器提醒任意用戶提供該用戶碼。45.根據(jù)權(quán)利要求40的方法,還包括存儲有關(guān)一用戶的合作行為的信息。46.根據(jù)權(quán)利要求40的方法,還包括提供多特征化的臉部設(shè)備,該多特征化的臉部設(shè)備包括多個可多位置的臉部特征;及至少生成代表至少兩個對應(yīng)的臉部表情的多個臉部特征的位置的三種組合。47.根據(jù)權(quán)利要求46的方法,還包括使這些特征以不同的速率在多個位置之間變動,從而生成不同情緒的錯覺。48.根據(jù)權(quán)利要求46的方法,還包括存儲一音頻聲明;及通過該揚聲器提供該音頻聲明;且與該聲明的輸出同步地生成多個臉部位置的組合。49.一種用于使用交互式對象,將編程教授給學生的系統(tǒng),該系統(tǒng)包括一計算機化的學生界面,允許一學生通過定義該交互式對象的特性賦與該交互式對象以生命,該計算機化學生界面進行工作以響應(yīng)于學生輸入至少部分地定義該交互式對象與人之間的交互;和一計算機化教師界面,允許一教師在定義該交互式對象的特性中監(jiān)視學生的進度。50.根據(jù)權(quán)利要求49的系統(tǒng),其中該計算機化教師界面允許該教師配置該計算機化學生界面。51.一種用于將交互式對象的設(shè)計和編程教授給學生的教授系統(tǒng),該系統(tǒng)包括一計算機化的學生界面,允許一學生通過定義該交互式對象的特性賦與該交互式對象以生命,該計算機化學生界面進行工作以響應(yīng)于學生輸入至少部分地定義該交互式對象與人之間的交互;和一計算機化教師界面,允許一教師配置該計算機化學生界面。52.一種用于開發(fā)情緒上有知覺的計算機化的創(chuàng)造物的計算機系統(tǒng),包括一計算機化的用戶界面,允許一用戶通過定義一情緒上有知覺的計算機化的創(chuàng)造物與自然人之間的交互來開發(fā)該情緒上有知覺的計算機化的創(chuàng)造物,該交互至少包括該情緒上有知覺的計算機化的創(chuàng)造物對從該自然人提供的一刺激所導出的,指示自然人情緒的至少一參數(shù)的至少一響應(yīng);和一創(chuàng)造物控制單元,其進行工作以根據(jù)由該用戶定義的這些特性和交互來控制該情緒上有知覺的創(chuàng)造物。53.根據(jù)權(quán)利要求52的系統(tǒng),其中該指示自然人情緒的參數(shù)包括除其語言內(nèi)容之外的自然人語句的特性。54.一種用于開發(fā)情緒上有知覺的計算機化的創(chuàng)造物的方法,該方法包括過定義該情緒上有知覺的計算機化的創(chuàng)造物與自然人之間的交互,該交互至少包括該情緒上有知覺的計算機化的創(chuàng)造物對從該自然人提供的一刺激所導出的,指示自然人情緒的至少一參數(shù)的至少一響應(yīng);和根據(jù)由該用戶定義的這些特性和交互來控制該情緒上有知覺的創(chuàng)造物。55.一種用于將編程教授給學生的方法,該方法包括提供一基于計算機化的虛擬編程的學生界面,允許學生執(zhí)行虛擬編程;并提供一計算機化的教師界面,允許教師使配置該計算機化的學生界面。56.一種計算機化的情緒上有知覺的計算機化的創(chuàng)造物,包括多個交互模式,用于實現(xiàn)對應(yīng)的多個與自然人的交互,該多個交互至少包括對指示自然人情緒的至少一自然人情緒參數(shù)的一響應(yīng);和一情緒感知單元,用于從由該自然人提供的一刺激導出至少一自然人情緒參數(shù),并將該參數(shù)提供給多個交互模式中的至少一個。57.根據(jù)權(quán)利要求56的創(chuàng)造物,還包括一真實的個體,用于參與多個交互模式中的至少一個。全文摘要一種交互式玩具設(shè)備,包括:具有有趣的物理外觀(17、18、19、20)的玩具(10),安裝在玩具(10)上的揚聲器(58),用戶輸入接收器(28),存貯有關(guān)至少一個用戶的信息的用戶信息存貯單元(74),響應(yīng)通過用戶輸入接收器(28)接收的當前用戶輸入以及存貯在存貯單元(74)中的信息以便通過該揚聲器向該用戶提供音頻內(nèi)容的內(nèi)容控制器(82)。文檔編號G10L25/63GK1272800SQ99800961公開日2000年11月8日申請日期1999年4月15日優(yōu)先權(quán)日1998年4月16日發(fā)明者奧茲·加拜,雅各布·加拜,尼姆羅德·桑德勒曼申請人:創(chuàng)造者有限公司
      網(wǎng)友詢問留言 已有0條留言
      • 還沒有人留言評論。精彩留言會獲得點贊!
      1