交互式玩具的制作方法

文档序号:3430938阅读:792来源:国知局

专利名称::交互式玩具的制作方法
技术领域
:本发明总地涉及计算机系统和方法,且更具体地涉及交互式构造的开发,讲授这样的开发的技术和言语交互式玩具。
背景技术
:在现有技术中已知有各种言语交互式玩具。总地说来,这些玩具可被划分成两类,计算机游戏和独立玩具。这些独立玩具典型地在内部装有电子电路,通常提供相对低水平的语音识别和非常有限的词汇,经常导致在玩耍期间儿童产生厌烦和进行破坏。计算机游戏可得到基本的计算能力的受益且因此可提供高水平的语音识别且使用户满意。它们的特征在于非言语方面是虚假的且因此缺乏与孩子门结合的能力。以下的专利相信代表了言语交互式玩具的技术状况授予郝格鲁(Haugerud)的美国专利No.4,712,184描述了一种计算机控制的教育玩具,其结构可起到教导用户关于计算机的术语和编程及机器人技术的作用。郝格鲁说明了通过有线连接的计算机玩具控制,典型地,其中的计算机用户需编写一个简单的程序来控制机器人的运动。授予罗斯(Rose)的美国专利No.4,840,602描述了一种会响应于外部信号而说话的玩偶,其中该玩偶有一个以数字数据形式存储在一个存储器中的词汇库,当该存储器被访问时将会使玩偶内的一个语音合成器模仿说话。授予兰格(Lang)的美国专利No.5,021,878描述了一种可实时控制的动画角色系统。授予兰格的美国专利No.5,142,803描述了一种可实时控制的动画角色系统。授予阿达伐(Aldava)等人的美国专利No.5,191,615描述了一种互联声动娱乐系统,其中向电视屏幕外面的一些会动和会听的玩具和其他可动装置提供与一个电视节目相同步的声音和控制数据,使之根据电视节目的进程与节目观看者互相作用。授予库利埃(Collier)的美国专利No.5,195,920描述了一种无线电控制的玩具车辆,它能产生逼真的声响效果。与一个远地计算机相通信可使得操作人能修改和增添新的声响效果。授予希卡瓦(Hikawa)的美国专利No.5,270,480描述了一种能响应于一个MIDI(乐器数字界面)信号而动作的玩具,其中一个玩着乐器的玩具会表演模拟的乐器弹奏动作。授予兰格的美国专利No.5,289,273描述了一种用来遥控一个动画角色的系统。该系统利用无线电信号把声频、视频和其他控制信号传送给动画角色,实时地使之说话、聆听、观看和运动。美国专利No.5,388,493描述了一种手风琴师用的容纳一个垂直双键盘MIDI无线控制器的系统。该系统既可按普通MIDI电缆连接使用,也可被无线MIDI发送系统使用。授予诺依希尔(Neuhierl)的德国专利DE3009-040描述了一种用来增添从遥控器向受控模型车辆发送声音的能力的装置。其中的声音由话筒或磁带录音机产生,并通过无线电通信发送给受控模型车辆。模型车辆上装备了一个能把接收到的声频信号放出来的扬声器。本说明书中所有提到和引用的出版物的公开内容均在此引用作为参考。发明的技术方案本发明目的在于提供克服上述现有技术缺陷的言语交互式玩具及其方法。根据本发明的一优选实施例提供了一交互式玩具设备,包括具有有趣的物理外观的一玩具;安装在该玩具上的一扬声器;一用户输入接收器;存储有关至少一用户的信息的一用户信息存储单元;和一内容控制器,其响应于经该用户输入接收器接收的当前用户输入和该存储单元中存储的信息进行工作,经该扬声器提供音频内容给该用户。再根据本发明的一优选实施例,该用户输入接收器包括一音频接收器。再根据本发明的一优选实施例,该当前用户输入包括经该音频接收器接收的一言语输入。再根据本发明的一优选实施例,该用户输入接收器包括一触觉输入接收器。再根据本发明的一优选实施例,该存储单元存储有关至少一用户的个人信息且该内容控制器进行工作以使该音频内容人性化。再根据本发明的一优选实施例,该存储单元存储有关至少一用户与该交互式玩具设备的交互的信息且该内容控制器进行工作以根据存储的有关该至少一用户与该交互式玩具设备的过去的交互的信息来控制该音频内容。再根据本发明的一优选实施例,该存储单元还存储有关至少一用户与该交互式玩具设备的交互的信息且该内容控制器还进行工作以根据有关该至少一用户与该交互式玩具设备的过去的交互的信息来控制该音频内容。再根据本发明的一优选实施例,该存储单元还存储由一用户经该用户输入接收器言语地输入的信息。而且,再根据本发明的一优选实施例,该存储单元还存储由一用户经该用户输入接收器言语地输入的信息。而且,再根据本发明的一优选实施例,该存储单元还存储由一用户经该用户输入接收器言语地输入的信息。再根据本发明的一优选实施例,该交互式玩具设备还包括一内容存储单元,存储经该扬声器待被播送给一用户的至少一内容标题的的音频内容,该至少一内容标题是交互式的且包含交互分支。而且,再根据本发明的一优选实施例,该至少一内容标题包括存储对应的多个内容标题部分的多个音频文件,该多个内容标题部分包括至少两个可替换的内容标题部分;和响应于一任意的一用户输入、一环境条件、一过去的交互、有关一用户的个人信息、一远程计算机、和一与时间有关的条件在这些可替换的用户部分之间的一文本定义分支。而且,再根据本发明的一优选实施例,该交互式玩具设备还包括一内容存储单元,存储经该扬声器待被播送给一用户的至少一内容标题的的音频内容,该至少一内容标题是交互式的且包含交互分支。而且,再根据本发明的一优选实施例,该至少一内容标题包括多个内容元素的并行部分,该多个内容元素的并行部分包括至少两个可替换的部分;和在这些可替换的部分之间的以一人性化方式的一文本定义分支。再根据本发明的一优选实施例,该用户信息存储单元被至少部分地定位在该玩具中。而且,再根据本发明的一优选实施例,该用户信息存储单元被至少部分地定位在该玩具外。而且,再根据本发明的一优选实施例,该内容存储单元被至少部分地定位在该玩具中。而且,再根据本发明的一优选实施例,该内容存储单元被至少部分地定位在该玩具外。再根据本发明的一优选实施例,该用户输入接收器包括安装在该玩具上的一麦克风,和接收自该麦克风输入的一语句的一语音识别单元。再根据本发明的一优选实施例,该用户信息存储单元进行工作以存储有关各可用一唯一码识别的多个用户的个人信息且该内容控制器进行工作以提醒任意用户提供该用户码。而且,再根据本发明的一优选实施例,该用户信息存储单元进行工作以存储有关一用户的合作行为的信息。再根据本发明的一优选实施例,提供具有改变脸部表情的玩具设备,该玩具包括多特征化的脸部设备,该多特征化的脸部设备包括多个可多位置的脸部特征;和一脸部表情控制单元,其进行工作以至少生成代表至少两个对应的脸部表情的多个脸部特征的位置的三种组合。而且,再根据本发明的一优选实施例,该脸部表情控制单元进行工作以使这些特征以不同的速率在多个位置之间变动,从而生成不同情绪的错觉。而且,再根据本发明的一优选实施例,该玩具设备还包括一扬声器装置、存储一音频声明的一音频存储器、和进行工作以通过该扬声器装置控制该音频声明的输出的一音频输出单元,且该脸部表情控制单元进行工作以与该声明的输出同步地生成多个位置的组合。再根据本发明的一优选实施例,还提供有用于播放一交互式言语游戏的玩具设备,包括一玩具;安装在该玩具上的一扬声器装置;安装在该玩具上的一麦克风;接收自该麦克风输入的一语句的一语音识别单元;和一音频存储单元,用于存储通过该扬声器装置待被播放的多个言语游戏段和在这些言语游戏段之间的一文本存储定义交互分支。再根据本发明的一优选实施例,这些言语游戏段包括提醒一用户生成对该言语游戏的一说出的输入的至少一段。再根据本发明的一优选实施例,该至少一段包括两或更多的言语串和一对该用户的提醒以再现这些言语串之一。再根据本发明的一优选实施例,该至少一段包括一谜。再根据本发明的一优选实施例,这些言语串中的至少一个具有教育内容。再根据本发明的一优选实施例,这些言语串中的至少一个包括有关在该游戏中的该用户的行为的性质对用户的一个反馈。再根据本发明的一优选实施例,该交互式玩具设备还包括与该玩具一起装配的包括多个可多位置的脸部特征的多特征化脸部设备;和一脸部表情控制单元,其进行工作以至少生成代表至少两个对应的脸部表情的多个脸部特征的位置的三种组合。而且,再根据本发明的一优选实施例,该脸部表情控制单元进行工作以使这些特征以不同的速率在多个位置之间变动,从而生成不同情绪的错觉。而且,再根据本发明的一优选实施例,该交互式玩具设备还包括存储一音频声明的一音频存储器;和进行工作以通过该扬声器装置控制该音频声明的输出的一音频输出单元,且该脸部表情控制单元进行工作以与该声明的输出同步地生成多个位置的组合。再根据本发明的一优选实施例,该交互式玩具设备还包括安装在该玩具上的一麦克风;接收自该麦克风输入的一语句的一语音识别单元;和一音频存储单元,用于存储通过该扬声器装置待被播放的一言语游戏的多个言语游戏段和在这些言语游戏段之间的一文本存储定义交互分支。再根据本发明的一优选实施例,这些言语游戏段包括提醒一用户生成对该言语游戏的一说出的输入的至少一段。再根据本发明的一优选实施例,该至少一段包括两或更多的言语串和一对该用户的提醒以再现这些言语串之一。再根据本发明的一优选实施例,该至少一段包括一谜。再根据本发明的一优选实施例,这些言语串中的至少一个具有教育内容。再根据本发明的一优选实施例,还包括安装在该玩具上的一麦克风;接收自该麦克风输入的一语句的一语音识别单元;和一音频存储单元,用于存储通过该扬声器装置待被播放的一言语游戏的多个言语游戏段和在这些言语游戏段之间的一文本存储定义交互分支。再根据本发明的一优选实施例,这些言语游戏段包括提醒一用户生成对该言语游戏的一说出的输入的至少一段。再根据本发明的一优选实施例,该至少一段包括两或更多的言语串和一对该用户的提醒以再现这些言语串之一。另外或可替换地,该至少一段包括一谜。再根据本发明的一优选实施例,这些言语串中的至少一个具有教育内容。再根据本发明的一优选实施例,这些言语串中的至少一个包括有关在该游戏中的该用户的行为的性质对用户的一个反馈。根据本发明的一优选实施例,还提供有一种玩具交互的方法,包括提供具有有趣的物理外观的一玩具;提供安装在该玩具上的一扬声器;提供一用户输入接收器;将有关至少一用户的信息存储进一用户信息存储单元;并经一响应于经该用户输入接收器接收的当前用户输入和该存储单元中存储的信息进行工作的内容控制器,,经该扬声器提供音频内容给该用户。再根据本发明的一优选实施例,该存储步骤包括存储有关至少一用户的个人信息并经该内容控制器使该音频内容人性化。再根据本发明的一优选实施例,该存储步骤包括存储有关至少一用户与该交互式玩具设备的交互的信息且根据存储的有关该至少一用户与该交互式玩具设备的过去的交互的信息经该内容控制器来控制该音频内容。再根据本发明的一优选实施例,该方法还包括在一内容存储单元中存储经该扬声器待被播送给一用户的至少一内容标题的的音频内容,该至少一内容标题是交互式的且包含交互分支。再根据本发明的一优选实施例,该方法还包括存储有关各可用一唯一码识别的多个用户的个人信息且经该内容控制器提醒任意用户提供该用户码。而且,再根据本发明的一优选实施例,该方法还包括存储有关一用户的合作行为的信息。再根据本发明的一优选实施例,该方法还包括提供多特征化的脸部设备,该多特征化的脸部设备包括多个可多位置的脸部特征;并至少生成代表至少两个对应的脸部表情的多个脸部特征的位置的三种组合。而且,再根据本发明的一优选实施例,该方法还包括使这些特征以不同的速率在多个位置之间变动,从而生成不同情绪的错觉。而且,再根据本发明的一优选实施例,该方法还包括存储一音频声明,并通过该扬声器提供该音频声明,且与该声明的输出同步地生成多个脸部位置的组合。根据本发明的一优选实施例,还提供有一种用于使用交互式对象,将编程教授给学生,例如学校的孩子们的系统,该系统包括一计算机化的学生界面,允许一学生通过定义该交互式对象的特性赋与该交互式对象以生命,该计算机化学生界面进行工作以响应于学生输入至少部分地定义该交互式对象与人之间的交互;和一计算机化教师界面,允许一教师在定义该交互式对象的特性中监视学生的进度。再根据本发明的一优选实施例,该计算机化教师界面允许该教师配置该计算机化学生界面。根据本发明的一优选实施例,还提供有一种用于将交互式对象的设计和编程教授给学生的教授系统,该系统包括包括一计算机化的学生界面,允许一学生通过定义该交互式对象的特性赋与该交互式对象以生命,该计算机化学生界面进行工作以响应于学生输入至少部分地定义该交互式对象与人之间的交互;和一计算机化教师界面,允许一教师配置该计算机化学生界面。根据本发明的一优选实施例,还提供有一种用于开发情绪上有知觉的计算机化的创造物的计算机系统,包括一计算机化的用户界面,允许一用户通过定义一情绪上有知觉的计算机化的创造物与自然人之间的交互来开发该情绪上有知觉的计算机化的创造物,该交互至少包括该情绪上有知觉的计算机化的创造物对从该自然人提供的一刺激所导出的,指示自然人情绪的至少一参数的至少一响应;和一创造物控制单元,其进行工作以根据由该用户定义的这些特性和交互来控制该情绪上有知觉的创造物。再根据本发明的一优选实施例,该指示自然人情绪的参数包括除其语言内容之外的自然人语句的特性。根据本发明的一优选实施例,还提供有一种用于开发情绪上有知觉的计算机化的创造物的方法,该方法包括定义该情绪上有知觉的计算机化的创造物与自然人之间的交互,该交互至少包括该情绪上有知觉的计算机化的创造物对从该自然人提供的一刺激所导出的,指示自然人情绪的至少一参数的至少一响应;和根据由该用户定义的这些特性和交互来控制该情绪上有知觉的创造物。根据本发明的一优选实施例,还提供有一种用于将编程教授给学生的方法,该方法包括提供一基于计算机化的虚拟编程的学生界面,允许学生执行虚拟编程;并提供一计算机化的教师界面,允许教师配置该计算机化的学生界面。还提供有一种情绪上有知觉的计算机化的创造物,包括多个交互模式,用于实现对应的多个与自然人的交互,该多个交互至少包括对指示自然人情绪的至少一自然人情绪参数的一响应;和一情绪感知单元,用于从由该自然人提供的一刺激导出至少一自然人情绪参数,并将该参数提供给多个交互模式中的至少一个;和任选地,一真实的或虚拟的,例如在屏幕上的,的物体,用于在多个交互模式中的至少一个中进行参与。附图的简要说明本发明将从以下参照附图的详细描述中被予理解且显见。图1A是形成根据本发明的一优选实施例构成并工作的一交互式玩具系统的至少一部分的一玩具的简化视图;图1B使图1的玩具的后视图;图2使图1A和1B的玩具的部分切开视图;图3是图1A和1B及2的玩具的元件的简化分解视图;图4A、4B、4C、4D和4E是指示脸部表情变化的图1A-3的玩具的视图;图5是本发明的一优选实施例的交互式玩具设备的简化方框图;图6是形成图5的设备的部分的一基台的功能方框图;图7是形成图5的设备的部分的一玩具中安装的一电路的功能方框图;图8A-8G结合在一起组成图5的基础通信单元62的概略性视图图8H-8N结合在一起组成根据一替换实施例的图5的基础通信单元62的概略性视图;图9A-9G结合在一起组成图5的玩具控制装置24的概略性视图;图9H-9M结合在一起组成根据一替换实施例的图5的玩具控制装置24的概略性视图;图10-15结合在一起组成图1-9G的交互式玩具系统的一优选的操作方法的简化流程图;图16A和16B结合在一起形成由图10的“播放”字模块执行的一文本的打开动作的一种可能实施方案的简化的工作流程图;图17A-17E结合在一起形成由图10的“播放”字模块执行的一故事文本的一种可能实施方案的简化的工作流程图;图18A-18G结合在一起形成由图10的“播放”字模块执行的一游戏文本的一种可能实施方案的简化的工作流程图;图19A-19C结合在一起形成由图10的“播放”字模块执行的一歌曲文本的一种可能实施方案的简化的工作流程图;图20A-20C结合在一起形成由图10的“播放”字模块执行的图17A-17E的“BunnyShort”故事文本的一种可能实施方案的简化的工作流程图;图21A-21F结合在一起形成由图10的“播放”字模块执行的图17A-17E的“兔子长片”故事文本的一种可能实施方案的简化的工作流程图;图22是在图17D、18C、19B和19C中所涉及的“主题部份”的简化的工作流程图;图23A是根据本发明的一优选实施例的一真实玩具活创造物的开发和操作的视图;图23B是根据本发明的一优选实施例的一虚拟活创造物的开发和操作的视图;图23C是对图23A-23B的系统进行变化的一系统的简化的半插图半方框图的视图,其中设置一远程内容服务器,其对在将生命赋与一计算机化的活创造物中有用的数据、程序、声音、文件和其他内容提供服务;图24A是一学生编程一计算机化的活创造物的视图;图24B是人与一计算机化的活创造物至少进行言语交互的视图,其中该交互如上所述参照图24A地由学生进行编程;图24C是装备有摄像机和例如液晶显示器(LCD)的视频显示器中的一构件的一创造物的视图;图25是一系统管理员的优选功能性的简化的软件设计视图;图26是例如图23A-23C的系统的一用于教授交互式计算机化的构造的开发的系统中的教师工作站312的优选功能性的简化的软件视图;图27是例如图23A-23C的系统的一用于教授交互式计算机化的构造的开发的系统中的学生工作站10的优选功能性的简化的软件视图;图28-31是作为用于可视编程块840840的一人界面的部分的屏幕显示的例子;图32是包括一投射的状态机器图的例子的图示的屏幕显示;图33是使学生建立一环境的屏幕显示,其中一先前生成的模块可被测试;图34-37是图23A、23B或23C中任一的教师工作站312给出的屏幕显示的例子;图38是学生典型地使用图23A、23B或23C中任一的学生工作站的过程的简化的流程图;图39是通过在该学生工作站310中的插入目录中的选择事件(Event)所生成的一屏幕显示的例子;图40是通过在该学生工作站310中的插入目录中的选择功能(Function)所生成的一屏幕显示的例子;图41是在执行图38的步骤910和920的过程中由学生执行的处理的简化的流程图;图42是一情绪交互作用流程设计过程的简化的流程图;图43-102是根据本发明的一优选实施例构成并工作的一计算机化的编程教授系统的优选实施例的视图;图103是一情绪分析数据库的表格图;图104是一情绪分析状态图;图105是典型的功能呼叫和回呼通知视图;图106是适用于一媒体BIOS模块的典型的输入数据处理视图;图107是适用于一UCP实现模块的典型的输入数据处理视图;图108是适用于用户应用和一API模块的典型的数据处理视图;图109是一典型的UCP实现模块和媒体BIOS输出数据处理视图;图110是用于可以协议实现模块和媒体BIOS模块的输出数据处理视图;图111是典型的图形构成的视图;及图112-115是典型的安装—检验(分别为BT1/4,2/4,3/4和4/4)视图。这里附有以下的附录,其目的在于理解和评定所示出及所描述的本发明的一优选实施例附录A是本发明的交互式玩具系统的一优选的软件实现的计算机目录;附录B是用于图8A-8G的设备的一优选的部分目录;及附录C是用于图9A-9G的设备的一优选的部分目录。优选方案的详细描述现在参照图1A。图1A是一个简化的玩具图,一般情况下,本发明将一个玩具标记为10。玩具10至少为所建造的交互玩具系统的一个组成部分,其操作符合本发明所优选的一个具体实现。尽管玩具10能够以多种物理配置加以实现,并仍可保持此处所描述的交互玩具系统的各种功能,但为了便于说明,图1A中仅显示了一个典型的玩具10,这一玩具10具有一个奇特的物理外观,并包括一个拥有一系列附件(例如胳膊14、腿16、眼睑17、眼睛18、鼻子19以及嘴20)的身体部分12。胳膊14和腿16可能是被动的″附件″,即可将它们配置为不可移动的,但眼睑17、眼睛18和嘴20可以是″活跃的″附件,即可将它们配置为可移动的。以下将参照图3~4E对此进行较为详细的描述。图1B是图1中所示玩具的一个背视图,而且还把玩具10典型地显示为一个具有有孔区22的玩具,在孔区22的后面可安装一个扬声器,以下将对此更详细地加以描述。图2是图1A和1B所示玩具的局部剖面图,显示了玩具控制设备24(通常安置在身体部分12中)和一系列用户输入接收器(例如那些位于胳膊14和腿16中用以接收触觉用户输入的开关26)以及一个用于接收音频用户输入的麦克风28。应明白允许把此处所描述的各种用户输入接收器定位在玩具10中的任何地方,例如鼻子19之后,只要它们能够根据要求由触觉和音频用户输入(例如话音输入)加以访问即可。应明白,令大量人们所知的传感器和输入设备(例如加速度测量器、方向传感器、接近传感器、温度传感器、视频输入设备等)中的任何一种(尽管并没有特别示出)都可并入玩具10,用以接收输入或其它刺激,从而并入此处所描述的针对本发明的交互式玩具系统的交互环境中。现在,请再次参照图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所驱动,而该盘由一个齿轮传动轴42和电机44加以控制。通过一个相应的运动部件38,电路24实现了一个具体附件所希望的一个运动,即取决于齿轮传动装置平台40相对于当前转动方向的所希望的转动方向控制电机44和齿轮传动轴42,以定向和移动齿轮传动装置平台40,齿轮盘40的方向是由光定位设备46所决定的。更可取的做法是,令齿轮传动装置平台40有选择地与运动部件38中一个单一的运动部件在某一时刻协作,而该选择时刻依赖于齿轮传动装置平台40的具体转动方向。另外还提供了一个针对音频输出的扬声器。能量典型地由电源48(通常为一个DC电源)加以提供。图4A、4B、4C、4D以及4E是对图1A~3所示玩具10的面部表情变化的图示说明。图4A显示的是按箭头50所指示的方向加以转动的眼睛18。图4B显示的是按箭头52所指示的方向加以转动的眼睛18。图4C显示的是已呈半闭状态的眼睑17,而图4D显示的是全闭状态的眼睑17。图4E显示的是按箭头54和箭头56所指示方向加以移动的嘴唇20。应明白,嘴20既可移动一片嘴唇也可移动两片嘴唇。现在请参照图5。图5是按照本发明的一个优选的具体方案所构造并可在这一方案中加以运作的交互式玩具设备的一个简化的结构图。这一方案典型地提供了一台计算机60,例如一台基于Intel公司PENTIUM微处理器的个人计算机,通过RS-232串行通信端口与一个基础通信单元62(典型地为一个基于无线电的单元)进行通信。通过并行端口、声卡的MIDI和音频端口、USB端口或任何为人们所熟悉的通信端口,可实现计算机60和基础单元62之间的通信。单元62典型地由电力供给装置64提供能量,这一电力供给装置可由一个AC电源供电。更好的方案是,令单元62包括一个天线66,用于与玩具10(图2)的玩具控制设备24进行通信,相类似,玩具控制设备24也应装备天线68。玩具控制设备24典型地控制电机44(图3)、开关26(图2)、一或多个用于检测玩具10的动作的运动传感器70、麦克风28(图2)、扬声器58(图3)。部件24、44、26、28、58以及70中的任何一个,均可由电源48(图3)提供能量。计算机60典型地提供了用户信息存储机制,例如,在一个硬磁盘上或在任何一个为人们所熟悉的、更为理想的非易失性存储媒体上,用以存储与用户相关的信息,例如用户的个人信息,这些信息包括用户名、一个唯一的用户代码(本发明将其称为″秘密名″,秘密名可能是用户的一个虚构名或其它奇异的名,典型地由用户预定义或选择)以及用户的年龄等。计算机60还可做为本发明所称的″内容控制器″。作为内容控制器,计算机60可识别与玩具10交互的用户、对通过玩具10(例如通过扬声器58)的控制内容的选择与输出,以下将会更详细地加以描述。内容控制器可利用与用户相关的信息,人性化那些提交给用户的音频内容,例如通过使用用户的秘密名来称呼用户,或以一种适合于用户性别的方式与用户交谈。计算机60还典型地可为存储内容标题提供内容存储,每一个内容标题包括一个或多个内容元素,用于响应通过以上描述的玩具10的用户输入接收器所接收到的用户输入、环境输入、或随机的输入。例如,一个内容标题可以是一个笑话、一个谜语或一个交互故事。一个交互故事可以包括许多内容元素,例如音频元素,通常情况下安排在一个用于顺序输出的脚本中。交交互故事典型地被划分为多个内容元素序列部分,而且把多个部分并行加以安排,以代表故事中每一点的可选的交互分支。内容控制器可根据玩具10的当前用户输入、先前的分支选择、或其它用户信息(例如过去的交互、用户的偏好、性别、环境或瞬时状态等)选择一个分支。计算机60可通过各种人们所熟悉的装置(例如通过与BBS或与Internet固定或拨号的连接)与一或多台其它的计算机(例如一台远程计算机)进行通信。计算机60可实时地或通过一个后台或批处理过程,从远程服务器上下载各种类型的内容信息,例如全新的内容标题、现存标题的附加部分或内容元素(例如脚本和话音文件)、一般化的信息(例如天气预报信息和广告以及教育材料)。从一台远程计算机那里所下载的信息,先前可能曾经针对某一特定用户进行过定制化处理,例如根据年龄、用户的地址、购买习惯、受教育水平以及现存的用户信誉所进行的定制化处理。内容控制器也可记录和存储从某一用户那里接收来的用户信息,用户信息是通过用户输入接收器(例如话音的或其它音频用户输入)加以接收的。计算机60包括语音识别能力,这一能力典型地通过硬件与/或软件,例如″AutomaticSpeechRecognitionSoftwareDevelopmemtKit(自动语音识别软件开发工具)3.0版″,(可从Lernout&amp;Hauspie话音产品、Sint-Krispisnstraat7、8900Leper以及Belgium),加以实现。语音识别可为内容控制器加以使用,用于分析来自用户的话音输入,以确定用户的选择,例如在与某一交互故事的连接中,以选择该故事的一个分支。内容控制器还可把语音识别能力用于对用户的识别,即由用户讲出秘密名或代码,并由麦克风28加以接收,从而实现对用户的识别。内容控制器还可提供对面部表情的控制。通过使面容的各部分以不同的速率在不同位置之间振动,面部机制(图5)可以提供复杂的和动态的面部表情。更理想的方案是,令面容的每一个部分至少拥有两个假设的位置。通常情况下,两个或更多的面容部分可在同一时刻以不同的速率,移向不同位置,以便提供一系列面部表情的组合,从而可产生各种不同的感情。更可取的是,内容控制器可控制面部特征的组合,与用户的交互或内容的输出同步发生,以提供一个自然的伴随表情,例如嘴唇的同步和眼睛的自然转动。更理想的方案是,内容控制器可记录那些与提供给用户的内容相关的信息以及与每一用户同玩具10之间的交互相关的信息,例如给每一用户所讲的具体的笑话和为每一用户所唱的具体的歌曲、用户对提示(例如问题或谜语或交互故事以及其它用户输入)的响应与选择。内容控制器可把与每一用户过去交互相关的信息,用于相继内容的选择和输出,另外还可适当地控制玩具10(例如当与一个先前并没有同当前用户玩过游戏的用户玩游戏),或影响交互的复杂度。最好能够把计算机60安置在玩具10内或物理地与玩具10组装在一起,以致于计算机60能够直接与玩具控制设备24进行通信,而不必通过基础单元62和天线66及68,例如通过有线装置或光无线通信方法。另外,也可把计算机60电子地与玩具控制设备24集成在一起。图6是图5所示的基础通信单元62的一个功能结构图。单元62典型地包括一个微控制器单元72,这一微控制器单元拥有一个内存74,单元72可通过一个适配器76与图5所示的计算机60进行通信,并典型地通过一个RS-232端口或如以上所述的其它形式与计算机60相连(参见图5)。单元72通过发送接收机78和天线66与玩具10(图2)的玩具控制设备24进行通信。发送接收机78通常为一无线电发送接收机。图7是图5所示的玩具控制设备24的一个功能结构图。设备24典型地包括一个微控制器单元82,它可通过一个发送接收机84(典型地为一无线电发送接收机)和天线68与图5所示的基础单元72进行通信。能量是由一个电力供给装置86加以提供的,电力供给装置86由电源48(图5)提供电能。更可取的做法是,让单元82控制与/或接收来自玩具接口模块88的输入,而玩具接口模块88将控制与/或接收来自如以上所描述的扬声器、麦克风、传感器、以及电机的输入。发送接收机84可以附加地或交替地与接口模块88进行通信,以实现麦克风输入和扬声器输出的直接通信。现在参照图8A~8G。图8A~8G共同构成图5所示基础通信单元62的一个示意图。附录B是图8A~8G所示装置的一张优选零件的列表。图8H~8N共同构成图5所示的基础通信单元62的另一可选方案的示意图。现在参照图9A~9G。它们共同构成图5所示玩具控制设备24的一个示意图。附录C是图9A~9G所示装置的一个优选零件的列表。图9H~9M共同构造图5所示玩具控制设备24的另一可选方案的示意图。现在参照图10~15。它们共同构成图1~9G所示交互玩具系统的一个优选的操作方法的简化流程图。应明白,图10~15所示的方法可部分地由计算机硬件和部分地由软件或全部由定制化的硬件加以实现。可取的做法是,令图10~15所示的方法作为由计算机60(图5)所执行的软件指令加以实现。应明白,图10~15所示的方法以及以下所描述的其它方法,不必以一种特定的顺序加以执行。事实上,出于实现上的原因,这些方法的某一具体实现很可能会按不同于另一个特定实现的顺序加以实现。图10描述了主要的软件模块以及相应的高层部件。操作典型地开始于接通可与基础单元62进行通信的通信端口,并通过基础单元62初始化计算机60与玩具控制设备24之间的通信。主模块还初始化一个语音识别引擎,并显示(典型地通过计算机60的显示器)用于以选择各种子模块的程序的主菜单。主模块典型地包括下列子模块1)″关于你的信息″是一个子模块,它可使用户根据用户的偏好配置该系统,即用户可通过装入相应的参数,例如用户的真实姓名、秘密名、出生日期、头发与眼睛的颜色、性别、以及通常睡觉与起床的时间等,对系统加以配置。2)″跟着唱″是另一个子模块,它提供了具体的内容,例如允许用户跟着一起唱的歌曲。3)″如何玩玩具″是一个教学子模块,它可教用户如何使用这一系统以及如何玩玩具10。4)″玩玩具″是一个子模块,它可把交互内容提供给玩具10,并指导玩具10与用户进行交互。5)″检查玩具″是一个子模块,它可帮助用户解决与该系统的操作相关的技术问题,例如当玩具的电池能量偏低和无法向基站提供足够的电力时应怎么办,以及6)″退出″是一个子模块,它能够使用户停止交互玩具系统软件的操作,并将其从计算机内存中加以清除。图11更详细地说明了图10所示″接通通信″步骤的一个优选的实现。典型的操作开始于对典型的系统参数(例如设置对各存储单元的文件系统的存取)的初始化。接下来的操作,将是加载显示元素、接通数据库、初始化玩具和通信驱动程序、初始化语音识别软件引擎,并为各种并行操作的活动创建独立的线程以便一个用户在与玩具交互的同时,另一个用户也可以把计算机屏幕和键盘用于其它应用,例如文字处理。图12更详细地显示了图10所示″关于你的信息″子模块的一个优选的实现。典型的操作开始于当用户在计算机屏幕的主菜单上选择了″关于你的信息″选项时。然后提示用户,请用户表明他是一个现存的用户还是一个新的用户。接下来,由用户提供用户标识,并继续进入一个注册步骤。图12中所示的部分或全部操作可根据玩具的话音指示加以执行。图13更详细地显示了图12所示注册阶段的一个优选的实现。典型的操作开始于加载一个注册数据库、选择一个秘密名,然后选择和修改显示在计算机屏幕上的参数。当选择退出选项时,用户返回到图10所描绘的主菜单。图14更详细地显示了图10所示″跟着唱″子模块的一个优选的实现。典型的操作开始于在计算机的屏幕上显示一部电影,并同时使(在基础单元的通信范畴内)所有玩具10通过它们的扬声器提供音频内容,例如电影的插曲。用户可以(例如通过键盘键入)选择前进到下一首歌曲或退出这一模块,并返回到主模块。图15显示了图10所示的″如何玩玩具″和″玩玩具″子模块的一个优选的实现。典型的操作开始于对所希望的脚本的初始化(以下将对此更详细地加以描述)、最小化计算机屏幕上的状态窗口、关闭线程、并返回到主菜单。计算机继续操作负责玩具运行的线程,并继续并行地在计算机屏幕上显示通信媒体的状态和脚本。现在请参照图16A和16B,它们共同构成由图10所示″Play--玩玩具″子模块所执行的一个脚本的打开动作的一种可能的实现,简化的操作流程图。与下列的动作识别符和动作相结合,可更好地理解图16A和16B的实现。打开<播放上表中标识为Op002的话音文件,图16A和16B所示方法的典型操作将开始进行。这可典型地通过指示玩具开始接受一个特定时间长度的话音文件得以实现。接下来,从计算机的存储单元中读出这一话音文件,并通过无线电基站与玩具控制设备进行通信。玩具控制设备把所接收的无线电输入与玩具的扬声器连接起来,无线电输入将通过玩具的扬声器加以输出。话音文件op002请求用户按压位于玩具鼻子或脚上的微开关。如果用户按下微开关,则脚本程序将会继续播放话音文件op015m、op020m或op025m,每一个文件都按照当前日期时间欢迎用户,然后请求用户说出他或她的秘密名,以向系统标识他或她自己。接下来,脚本程序用三秒钟的时间记录用户的话音响应。记录工作是由计算机来完成的,即计算机将向玩具发送一条命令,命令玩具把玩具的麦克风与玩具无线电发射机连接在一起,并用三秒钟的时间发射所接收的音频输入。无线电通信由无线电基站加以接收,传送给计算机,并作为一个文件存储在计算机的存储单元中。接下来应用软件根据所记录的文件执行语音识别。然后把语音识别过程的结果返回给脚本程序。脚本程序根据用户的响应,继续播放一条对应于所标识秘密名的人性化的欢迎消息,或播放另一条有关识别工作未能成功进行的消息。这一欢迎消息还请求用户在多个选项(例如一个故事、一个游戏或一首歌曲)之间加以选择。用户的选择是通过记录用户的话音响应和执行语音识别加以接收的。图17A~17E、18A~18G以及19A~19C分别更详细地描述了一个故事、一个游戏和一首歌曲的简化的优选的实现。图17A~17E共同构成了图10所示″Play--玩玩具″子模块所执行的一个故事脚本的一个可能的实现的一个简化的操作流程图。与下列的动作识别符和动作联系在一起,将可更好地理解图17A~17E的实现故事菜单图18A~18G共同构成了由图10所示″Play--玩玩具″子模块所执行的一个游戏脚本的可能的实现的一个简化的操作流程图。与下列动作标识符及动作相结合,将会对图18A~18G所示的实现有更好的理解游戏菜单<<>图19A~19C共同构成由图10所示″PLAY--玩玩具″子模块所执行的一个歌曲脚本的可能的实现的一个简化的操作流程图。如果与下列的动作标识符和动作相结合,可对图19A~19C的实现更好地加以理解唱歌菜单<图20A~20C共同构成图17A~17E所示″兔子短片″故事脚本的一个可能的实现的一个简化的操作流程图,并由图10所示的″玩玩具″子模块加以执行。与下列的动作标识符和动作相结合,可对图20A~20C的实现更好地加以理解兔子短片图21A~21F共同构成图17A~17E所示″BunnyLong″故事脚本的一种可能的实现的一个简化的操作流程图,它由图10所示的″Play--玩玩具″子模块加以执行。对照下列的动作标识符和动作列表,可以更好地对图21A~21F所示的实现加以理解兔子长命图22是图17D、18C、19B以及19C所涉及的″ThemeSection--主题部分″的一个简化的操作流程图。主题部分向用户提供了对整个应用的一个总的介绍和一个教学部分。附录A是以上所述交互式玩具系统的一个优选的软件实施例计算机列表。本发明的交互式玩具系统软部件的一个优选的实现方法描述如下1)提供一台可运行WINDOWS95操作系统的计算机;2)附录A中如下标记的源代码*InstallationSourceCode(安装源代码)*ApplicationSourceCode(应用源代码)*针对语音识别的ActiveX源代码*CREAPI.DLL*CRPRO.DLL*BASEIO.DLL*ToyConfigurationSourceCode(玩具配置源代码)编译成可在步骤1)中所提供的计算机上执行的相应的可执行文件;3)安装针对WINDOWS95的″AutomaticSpeechRecognitionSoftwareDevelopmemtKit(自动语音识别软件开发工具)3.0版″,来自Lernout&amp;Hauspie话音产品、Sint-Krispisnstraat7、8900Leper、Belgium。4)把附录A中以如下标记的源代码*BaseStationSourceCode(基站源代码)*ToyControlDeviceSourceCode(玩具控制设备源代码)编译成相应的可执行的文件,并分别安装进图5所示的基础通信单元62和图5所示的玩具控制设备24中。5)运行对应于InstallationSourceCode(安装源代码)的可执行文件。6)运行对应于ToyConfigurationSourceCode(玩具配置源代码)的可执行文件。7)运行对应于ApplicationSourceCode(应用源代码)的可执行文件。应明白,这里所展示和所描述的交互式玩具系统的操作,不仅考虑到普通日期的情况,而且也将考虑到诸如节假日以及孩子的生日等日历信息,例如玩具可以在孩子的生日输出特殊的消息,或可在夜晚生成一个″疲劳的″面部表情。较理想的做法是,至少这里所展示和所描述的玩具装置的某些处理功能可由一台通用的或家庭计算机(例如一台PC)加以提供,并使这一计算机能够以任何合适的方式与玩具装置进行通信,典型地为无线通信,例如无线电通信。更可取的方案是,一旦玩具得以建立,包含玩具处理功能的PC程序运行在后台方式中,允许其它用户,例如成人在孩子们玩玩具的同时,把家庭计算机用于他们自己的其它应用。与本发明共有未决的PCT申请--PCT/IL96/00157、共有未决的以色列的专利申请--121574以及共有未决的以色列的专利应用--121642,描述了一些在生成计算机化的玩具过程中使用的技术与装置,本发明把它们所公布的技术与装置并入此处,以作参考。在本专利文档的公布中,有一个其所包含的内容必须得到知识产权保护的部分。若本专利文档或专利公布中的某一技术或装置出现在美国专利和商标局的专利文件或记录中,则知识产权的拥有者不反对按本专利文档或专利公布对这一技术或装置进行精确的复制,除此之外,知识产权的拥有者保留所有技术或装置的知识产权。在本发明的说明书和权力要求书中,术语″计算机化的创造物″或″计算机化的活的创造物″用于表示那些可由计算机控制的创造物,它们既可以是存在于计算机屏幕上的虚拟的创造物,也可以是具有实际、有形身驱的物理的玩具创造物。一个创造物既可以是创造物,也可以是人,甚至可以是其它形式的物体。″把生命赋予″一个创造物,指的是把类生命的行为赋予创造物,典型地通过定义自然人与该创造物至少一个交互加以实现。从创造物的角度来看,更理想的做法是,这一交互包括由那些由自然人所表露的情感的觉察。一个″自然人″指的是一个由上帝所创造的人,且在传统世界的感觉上是活的,而不是针对虚拟人、玩具人以及玩具娃娃等。现在参照图23A~23B,它们共同说明了符合本发明的一个优选实施例的一个计算机化的活的创造物的开发与操作。图23A显示了一个物理的创造物,而图23B显示了一个虚拟的创造物。如图23A和23B所示,它们提供了一个用于教授交互计算机化结构开发的教学设施,典型地包括一系列学生工作站310和一台教师工作站312,它们通过一条总线314与一台教学设施服务器316互连。教学设施服务器316可向教师工作站312和学生工作站310提交适当的内容。更可取做法是,提供一台创造物生命服务器318(这里也称作″创造物支持服务器″或″创造物生命支持服务器″)。如以下所描述的,这一服务器为一个创造物324提供了由学生编程的类生命的功能。也可把服务器316和318合并为一台单一的服务器。作为进一步的选择,可提供多台创造物支持服务器318,每一台支持一个或多个计算机化的活的创造物。还有一种选择(未在图中加以显示)是,提供一台单一的中央计算机,学生和教师工作站可由那些通过中央计算机加以支持的终端组成。如图23A所示,理想的方案是,把创造物生命支持服务器318与一个计算机无线电接口320相藕合,而这一接口最好与一个在计算机化的活的创造物324中的一个相应的控制器322进行无线通信,由此对计算机化的活的创造物324的动作与响应加以控制和存储,以及最好把其内部化的经验加以保存与分析。由创造物生命服务器318所提供的计算机化的活的创造物324具有一系列不同的拟人的感觉,例如听觉、视觉、触觉、温感、位置感和最好这些感觉的合成以及可由学生编程的感觉,例如触摸的感觉,这些感觉可通过适当的与计算机化的活的创造物相关连的音频、视频、接触、温度以及位置传感器来提供这些感觉。另外,按照本发明的一个优选的实施例,计算机化的活的创造物324被赋予一系列拟人的表达方式,例如言语、动作、面部表情以及各种表达方式的组合形式,例如高兴、生气、悲伤以及惊讶等。这些表达结构可通过利用适当的机械和电子机械驱动器而得以实现,并可通过创造物生命服务器318根据学生的程序得以生成。现在参照图23B。可以看出,一个虚拟的计算机化的活的创造物可以在计算机338的显示器336上得以创建,计算机338可直接或通过网络(例如Internet)与总线314相连。更可取的做法是,为虚拟的计算机化的活的创造物334赋予一系列不同的拟人感觉,例如听觉、视觉、触觉、温感、位置感,最好还赋予这些感觉的合成,例如触摸感。建议的做法是,通过把麦克风340、照相机342、触摸垫或其它触摸输入设备344与计算机338相关联,来提供这些感觉。更理想的是,还可把一个扬声器346与计算机338关联在一起。服务器348典型地既可执行图23A所示的教学设施服务器316的功能,也可执行图23A所示的创造物生命服务器318的功能。另外,根据本发明所优选的实施例,需赋予虚拟的计算机化的活的创造物334一系列拟人的表达方式,例如言语、动作、面部表情以及各种表达方式的组合形式,例如高兴、生气、悲伤以及惊讶等。它们是由适当的传统计算机技术加以实现的。本发明一个较好的特性是,在计算机化的活的创造物以及在与其交互的人这两个方面,都能通过适当的编程,基于以上所提到的拟人的感觉和表达方式,为计算机化的活的创造物提供与人的交互能力。更可取的是,能够令这些交互包括上述感觉的组合及表达方式的组合。图23C是图23A~23B所示系统的一个衍生系统的半图示、半结构化的简化图。该系统提供了一台远程内容服务器340,提供把生命赋予创造物324所用的数据、程序、话音文件以及其它内容。图24A是学生利用其中一台仿真显示器对该创造物进行编程的图形表示,编程是通过该学生与该学生的工作站310交互作用来实施的。这种交互可以是语言的或可以通过其它合适的输入设备如键盘或鼠标来完成。在说话以及“停止”之前的命令“播放记录”意思是该学生工作站应在“播放记录”之后记录由该学生发出的说话内容,直到“停止”但不包括“停止”,并把说话内容存储在一个语音文件中,同时该创造物的生命服务器318应指导该创造物324发出存储在该语音文件中的说话内容。“If-then-endif”,“语音识别”“语音类型”“and”以及“or”都是控制字或命令或编程指令,如图31所示。图24B是人与计算机化创造物的语言交流的图形表示,其中该交流是学生按照上面描述的参照图24A进行编程的结果。图24C是配备有内置的视频照像机342和视频显示器582如液晶显示器(LCD)的创造物324的图形表示,该视频照像机为该创造物提供了视觉输入并且通过该创造物或无线通信到计算机。该显示器可以使该计算机为用户提供更为详细的信息。在图中,该显示用于提供更细致、更灵活的表情如眼睛、眉毛。彩色显示器可以使计算机调整眼睛的颜色以适应用户或其它主题。本发明的一个特定的特征是提供有教育工具来培训工程师或编程者来生成交流指示。一个教师可以为全班的学生确定一个整体项目,如对一个警察的行为进行编程。他可以定义一些可以分成特定事件的总的条件,而每一个事件可以分给一个学生用于编程一个交互的套件。例如,警察的行为可以分成如下模块与受害人的亲属进行交流,与同事、老板进行交流,与要进行犯罪控诉的控诉方进行交流,与嫌疑人、同伙及目击者进行交流。根据所涉及的犯罪是谋杀、暴力中的非谋杀、恶意犯罪、侵犯财产犯罪等,每一个交流以可以分成子模块,而每一个模块或子模块可以分给不同的孩子。类似,一个项目又可以包括对学生的行为的编程。换句话说,该情绪化理解性的创造物是学生,该项目可分成例如如下的模块面向教师的行为、面向模块的行为以及面向其他孩子的行为。面向其他孩子的行为又可以分成如下的子模块,如秘密俱乐部的成立、一起学习、闲谈、请求帮助等。为编程一个特定的子模块,一般要求学生至少执行下列子模块中的一些a.选择触发进入他的子模块的初始事件。听到单词“俱乐部”可触发进入“成立秘密俱乐部”子模块,这些初始事件可以形成该模块的状态机的一部份或者可以优先地被连带的学生或教师合成一个主程序,该主程序可以根据各种事件的发生调用各种模块。b.列出与该对话相对应的主题以便维持在该学生与靠近该学生的某人之间。例如,为成立一个俱乐部,该俱乐部一般需要一个名称、会员清单、密码、标志、规则等。c.确定这些主题之间的关系。例如,一旦建立了会员清单,该密码需要被传送到会员清单上的所有会员。d.在该学生与该某人之间提供一个分支对话框,设计成该学生的每一个意见均会引起该某人一个响应,该响应可以很容易地被加以分类。例如,该学生可能希望只问有限选择的问题而不是自由回答的问题。例如,如果学生问“该标志的颜色应是什么颜色,白色、黑色或红色?”,那么系统只需要识别三个单词中的一个。e.确定如何检测情感及决定在学生-该人的关系中不同情感的角色。例如,结合该某人,如果该学生正在定义该成员清单,该学生可能就会注意到该某人正在变得感情丰富,该学生可因此选择建议终止该成员清单或表现得感情专注。可选地或附加地,对于该某人三个或四个不同的感情状态,该学生的每一个意见可以有稍许不同的文本。其它项目包括对教师、父母、宠物、销售商、名人等的行为的编程,应明白,项目的范围是无限制的。应明白,对一个情绪上有知觉的生命的编程的复杂性会预料到产生娱乐条件,由此该情绪上有知觉的生命会以一种有缺陷的方式运行。于是,通过使学生错误与一个诙谐的结果联系起来而缓解伴随该学生错误或学生失败条件的压力,希望增强学习条件。对一个情绪上有知觉的生命的编程的困难并不是实施这里所显示及描述的系统的困难,因为系统的目标是教育性和正确性,而情绪上有知觉的生命的完整功能只是一个艺术品,而不是该系统和目标。而且,虽然对一个情绪上有知觉的生命的编程是非常困难的,甚至过份单纯化的感情敏感性(当由一台机器规划好时)对于人与该机器的交互产生很大的影响。因此,感情理解力的编程,即使在初级水平上,都是一个有所回报的活动,因而能激发学生通过实践增强其编程的能力。图25是一个系统管理器的优选功能的简化软件图,最好其中的一个教师工作站312作为一个系统管理器工作站使用。图26是系统中教师工作站312的优选功能简化软件图,该功能用于指导开发交互式计算机化指示,如图23A-23C中系统。学生管理功能(图25中的单元715)典型地包括常规功能,如学生注册、学生特征的统计分析、学生报告的生成等。集成化(单元740)可以通过多组学生或该教师来执行,该教师工作站为该教师提供一个定义各模块被组合的顺序的集成方案。运行管理功能(单元750)用于管理多个生命服务器318。例如,一个教师在其布置阶段15上可能具有由3个创造物生命服务器控制的创造物和由300个学生开发的30个项目,并且每一个包括几个项目模块,其中的某些项目模块是可选的。运行管理功能使教师能够确定在某一确定的天和时间,利用一特定的项目,一特定子集的创造物将被一特定的创造物生命服务器所控制。如果该项目包括了可选模块,教师可以定义使用其中的哪些。图27是系统中学生工作站310的优选功能简化软件图,该功能用于指导开发交互式计算机化指示,如图23A-23C中系统。图27中的分析和设计方块815典型地包括字处理功能、画流程图功能和允许学生归档他对该项目模块的分析的数据库规划设计功能。图27中的视觉编程方块840优先运行以使得学生能定义和参数化软件对象以及使这些对象与其他对象相联系。软件对象包括子模块;诸如时间事件、口语事件、数据库事件、传感器事件以及上述事件的组合的事件;诸如动作功能、讲话(回放)功能等的功能;针对状态机的状态;以及并行运行的任务。例如,视觉编程的典型会话包括如下步骤a.学生选择“视图”,然后是“状态机”,以便观察当前定义他所在班级所分配的项目中的模块的状态机。作为响应,系统向学生显示当前的状态机。b.学生选择“插入”,然后是“状态”,由此加入一个新的状态到该状态机。c.学生选择“插入”和“连接”,以便将新的状态连接到状态机中的已有的状态。d.学生为所选择的连接定义一个事件和功能,该功能可以从功能选项下列出的已有功能中选取,也可以利用程序块选项及第三代编程语言如Basic或者通过打开该功能内的一个状态机来生成。选择可以通过合适的接口机制来实施,如工具框的图标的下拉或从一个菜单条进行选择以及随后从与菜单条项相关的菜单中选择。视觉编程单元840一般允许学生选择多个“视图”中之一,而每一个这样的“视图”都包括一个由该学生如此编程的此模块的不同的说明。该视图例如可包括a.在赋给该学生的模块内的子模块;b.在该模块内的事件列表。事件典型地包括时间事件,传感器事件,语言事件,数据库事件(如数据库内的一个特定的计数器达到零)以及上述事件的组合。一个事件可以从scratch中产生、修改或与一个源状态和目标状态之间的已有连接相关联;c.表明该模块内状态及其间的连接的状态机;d.任务列表,其中每一个任务包括一序列功能和/或模块,并且在任务之间定义了一个关联以便允许不同的任务可并行地执行;e.在该模块内的功能列表,功能典型地包括语言功能,如谈话、语音识别和记录,致动器功能,如电机功能和点火功能,数据库功能,如对存储在该数据库中数据进行的计算。一个功能可以从scratch中产生、修改或与一个源状态和目标状态之间的已有连接相关联。在每一个视窗内,该学生可以修改或增加在该视窗内所表现的模块的各个方面。例如,为修改与该状态机内的个别连接相关联的一个事件,该学生一般可以访问该事件列表并修改该事件的定义,或者,学生或可以访问该状态机并选择一个不同的事件以与该个别连接相关联。图28-31是屏幕显示的例子,是针对视觉编程单元840的一个人机接口的部份。如图28中菜单条所示,学生最好可以选择执行下列活动之一常规文件操作,常规编揖操作、视图操作、插入操作、仿真操作以及常规的窗口及帮助操作。利用该视图菜单,也如图28中所示,该学生可以选择观察他所开发的该模块的各种表示,例如项目图示、模块图表以及任务列表等。在图28中,该学生可以选择在该视图菜单内的连接。作为响应,一般在屏幕在显示该学生,以及在其模块内的已有状态机连接的列表。该学生也可以选择一个或另一个连接。如所示,该学生已选择了连接t6,作为响应,学生可以看到连接t6的参数据的屏幕显示,包括连接源和目标状态,与该连接相关的事件和功能。一般地,每个功能是一个或多个原始功能如“播放”“记录”“设置表达式”的组合。图29说明在响应学生从该视图菜单选择状态而产生的一个模块的状态机视图。如所示,在状态表中显示了互连,其中该创造物从一个状态移动到另一个状态,其中从一个状态移动到另一个状态是根据在状态之间出现的事件的发生而有条件的,并伴随有在状态间出现的功能的发生。例如,在状态2与状态6间的转移与事件7和功能7相关联。这意味着当该创造物处于状态2时,如果它检测到事件7,它就执行功能7并移到状态7。例如,事件7可以是该自然人兴奋,这是一个复杂的事件,是几个原始事件如高声、高调、在语句末的音调的增加以及由语音识别单元检测到的“兴奋”等的组合。功能7例如可以是下列消息的发送“你今天看起来非常地高兴,对吗?”。状态6例如可以是一个对情感诊断状态确认的等待,其中该创造物等待该自然人确认或拒绝该创造物对该自然人正处于“高兴”的理解。状态2例如可以是情感改变状态,其中已经检测到情感的改变,但新的情感还没有被特征化。“U”表示从一个状态到另一个状态的无条件改变。在图30中该学生正通过插入一个新的功能来修改该模块,该功能试图与该状态机内的状态-状态的连接相关联,正在显示该学生正在插入的功能是“记录2秒”。应明白,在观察选项(图28)下的功能选项可被用来定义作为一序列已有功能的功能。图32的屏幕显示包括一个项目的状态机观察的说明示例。如所示,在状态间的每一个连接的特征在于一个事件和一个功能。事件的发生导致功能的执行以及进程从当前状态流到下一个状态。例如当系统处于状态1时发生事件E1,那么系统执行F1并进到状态6。在图32中,状态由椭圆、事件由菱形、功能由矩形表示。为了对一个连接插入一个事件和一个功能,学生可以从图32的显示选择所期望的连接,然后在视觉编程的主菜单条中选择插入,然后依次选择功能和事件。图33的屏幕显示使学生能创建一个能测试先前生成的模块的环境。为此,学生一般要按如下去做a.学生生成激励该模块的软件仿真(开始设置);b.学生生成处理到该模块的输入和来自该模块的输出的的仿真环境。也就是,在步骤b生成的仿真环境仿真性地提供到该模块的输入以及,按照该模块的仿真性输出接收和动作,使该环境又作用回到该模块。c.学生定义一个监视该模块的性能的设置。一般地,学生定义某个被检测到的事件将被显示到屏幕上以及某个被检测到的事件被记录到一个日志文件。d.学生执行仿真,同时监视该屏幕;以及e.学生观察该日志文件的内容。图34-37是说明由图23A、23B或23C的教师工作站312提供的屏幕显示的例子。特别是,图34是在图26的学生管理单元715内生成的屏幕显示的例子。如所示,该屏幕显示使教师能进入和修改学生标识的细节以及观察赋与每个学生的项目和模块,尤其是项目和模块的状态。该模块也可以允许教师给学生分配一个标记。可选地,分配标记也可以是执行监视的一部份(单元760)。学生对项目与模块的分配一般地在项目模块分配单元730内来执行,如下面参照图35所描述的。图35是在图26的项目模块分配单元730内生成的屏幕显示的例子。如所示,教师一般从一个项目菜单中选择一个项目,该项目菜单一般地显示每一个项目的属性如难度级别、模块数量等。在图13中,教师选择了“警察”项目。如所示,在该项目内有几个模块。教师也可以选择一个班以执行该项目。在图35中,教师选择了3A并且作为响应,屏幕向教师显示班3A中学生清单。该屏幕还向教师显示在该“警察”项目中模块清单,然后,通过单击在学生菜单中的所选学生,教师分配一个或多个学生给每一个模块。图36是在图26的集成监视单元740内生成的屏幕显示的一个例子。如所示,教师一般确定模块被集成以形成该完整项目的至少一个序列。一般地,系统画出彼此要集成的模块间的连接的图形表示,而每一个这样的连接被标记以一个日期和一个状态指示(集成/非集成)。图37是在图26的分配运行单元755内生成的屏幕显示的一个例子。该分配运行单元在所生成的创造物是一个自然创造物而不是一个虚拟创造物时显得特别重要。如果是这种情况,则该自然创造物是一个可被多个学生共享的稀有资源。如所示,该教师典型地从一个可用的自然创造物池中选择一个自然创造物,如红警察,当工作在该警察项目上时,在教师定义的时间内,所选的自然创造物执行由该教师的学生所定义的功能。如果两个不同的模块被分配到同一时间和同一创造物,亦即,如果指示红色警察运行在“犯罪关系”模块和“嫌疑”模块,那么该教师定义一个优先权系统以便这种跨越最小化。图38是该过程的简化流程图示,借助于此,学生典型地使用图23的学生工作站310。在执行图38的步骤910和920过程中由该学生执行的过程的流程图说明将参照图41进行说明。如所示,一开始,教师或项目策划者定义状态,即表情范畴(高兴、悲伤、愤怒)。一个学生按照从人那里记录/接收的语言输入的内容和/或特征,在运行中定义每一个表情范畴。该学生将到分区表情的事件定义进范畴。语言输入的特征包括语音幅度,语音音调、说话频率以及用词质量。学生显性地定义一个问号确认各种表情范畴。学生定义每一个问号为一个状态、每一个问号为一个功能以及每一个问号的结果为一个事件。学生和/或教师根据人的表情的范畴确定与人交流的修改。图39是通过在学生工作站10内的插入菜单中选择事件所产生的屏幕显示一个例子。如所示,被选择的事件包括关闭各种开关,尤其是,该事件包括关闭在该创造物的右手侧的开关或关闭在该创造物的右足侧的开关。图39是通过在学生工作站10内的插入菜单中选择功能所产生的屏幕显示一个例子。如所示,被选择的功能包括一个眼睛移动,尤其是,该功能包括移动该眼球到左侧。本发明的较佳实施例及其相关技术将参照附图42-68加以说明。LOLA应用的一个优化结构在图42-68图表中加以描述。LOLA系统是一个由几个主进程构成的分布式应用。地址和数据的空间界限分离开可驻留在一个计算机或该网络内的不同计算机上的这些进程。这些进程使用标准的中间件(MW)如CORBA/DCOM/RMI以便彼此进行透明地通信。这些主进程包括任务分配器这些部件运行在与活(living)对象进行通信的每一个无线电基站,在这些部件内的主要子部件在图42-68中加以描述。代理对象责任系统中每一个活对象都有一个表示它的相应对象。对一个活对象所做的所有操作都在其代理对象上首次激发,并且由活对象生成的所有事件都在其代理对象内首次接收。而且,该代理对象负责存储和跟踪每个活对象的状态。该代理对象是一个远程对象以便允许进程间通信。代理所使用的服务(协作)*代理正使用所提供的JavaBean以便激发操作和接收来自活对象的事件;*安全管理器以便检验一个请求的操作是否是合法的;*日志和事件服务以便记录消息和生成事件;提供给其它部件的服务*由该分配器产生的任务与该代理们进行本地交互;*IDE可以与代理交互以便允许远程调试或执行;*管理控制台可以与该代理远程交互以便激发诊断与监视操作;分配器引擎责任从任务管理器获取用于执行的已注册的任务,并以独立的线程执行每一个任务。该任务运行在灰箱(sandbox)内以便加强安全策略。由该分配器使用的服务*任务管理器以便接收所注册的任务;*所产生的任务使用代理对象以便激发对活对象的操作;*定时器,以便接收时间事件;*日志和事件服务,以便记录消息和产生事件;提供给其它组件的服务*IDE可以与该分配器交互以便协作远程调试或执行;*管理控制台可以与该分配器远程交互以便激发诊断与监视操作;定时器责任为注册的听众产生时间事件。由该定时器使用的服务*该定时器并不使用由LOLA系统提供的任何服务,它只使用OS服务。提供给其它组件的服务*该分配器在该定时器中注册以便接收时间事件。LOLA服务器该组件向系统中所有的其它组件提供所需要的服务,在此组件中的主子组件在图42-68中加以描述。日志服务器责任该日志服务器负责记录系统中其它组件的日志消息,并按照几个标准检索这些消息。日志消息跟事件不一样,它只是日志,即,它仅记录信息,而不是期望会根据此日志消息触发某些动作。由该日志服务器使用的服务*永久存储服务,以便将日志永久保存。提供给其它组件的服务*该分配器和该代理记录在任务执行期间的某些任务;*管理控制台和学生IDE,以便跟踪某些特定任务的执行;*教师管理控制台,以便接收关于任务执行的统计。监视引擎责任监视器引擎负责接收来自系统中其它部件的事件,并且根据事件-条件-动作逻揖而动作。该监视器引擎在系统范围的基础上提供这种逻揖,即便是该部件可以另外地驻留在每个无线电基站以便允许事件的本地处理。由监视器引擎使用的服务*永久存储服务,以便永久地保存策略和所接收的事件。提供给其它部件的服务*在任务执行期间或当测试系统的安全性时分配器和代理产生事件。*管理控制台,以便接收事件并相应地进行动作。安全管理器责任该安全管理器将系统中的所有的用户、组及角色保存在一个库中,并且根据它们来决定谁有权做何种事。由该安全服务器所使用的服务*永久存储服务,以便永久地保存用户、组和角色。提供给其它部件的服务*代理,以便确认在其上所触发远程操作。*任务管理器,以便确认允许特定的任务注册。任务管理器责任该任务管理器把系统中所有的任务保存在一个库中,并据其向无线电基站提供所应执行的任务。由该任务管理器使用的服务*永久存储服务,以便永久保存这些任务。*安全管理器,以便确认任务注册。提供给其它部件的服务*无线电基站,以便接收所注册的任务。管理控制台该部件是管理员的控制台,监视和控制系统的动作以及配置系统等,而且,该控制台可以使教师查询系统以便制作一些任务,如评估学生工作,或分配给学生执行某些特定任务的许可。在该部件中的主要子部件示于图42-68中,在图中也示出了这些部件的在线观察。责任该控制台用于联机监视和控制该系统,观察诸如在每个无线电基站上运行的任务之类的东西,以及每个活对象的状态和情况。触发例如改变一个特定的活创造物的信道的操作的能力,以及观察系统中产生的所有事件的能力。由联机观察所使用的服务典型地包括*代理对象,以便触发其上的操作及从中接收事件;*分配器,以便以一种在线方式监视和控制任务的执行;*监视器引擎,以便在系统范围基础上接收事件。提供给其它部件的服务*在线观察仅是一个GUI客户。在图中示出了配置视图。责任在其运行时用于配置系统的控制台,如定义用户、组及角色的配置由控制台进行。由该配置视图所使用的服务*安全服务器,以便授权经触发的操作。提供给其它部件的服务*配置视图仅是一个GUI客户。脱机观察责任不在系统正常运行期间(如升级、填加活对象等)对系统进行配置。由该配置视图使用的服务提供给其它部件的服务该配置视图仅是一个GUI客户。教师控制台责任该控制台由教师使用以便评估学生的工作。教师被提供有如学生工作的普及和关于任务执行的其它统计的信息。而且,教师可以观察由学生所写的所有任务的资源。由该配置视图所使用的服务*任务管理器,以便观察其学生任务的资源;*日志服务器,以便获取关于任务执行的统计信息。提供给其它部件的服务*脱机观察仅是一个GUI客户。集成开发环境(IDE)该部件运行在每个学生编程工作站上,其结构支持下列三种可能性*位于学生家中的独一无二的PC机,不连接到互连网。*位于学生家中的PC机,其通过互连网连接到LOLA系统。一个防火墙位于学生家中的PC机与LOLA系统之间。*位于企业内部互连网上的PC机,其通过标准的中间设备连接到其它LOLA部件。IDE核心责任由学生所使用的集成开发环境用于编写由任务分配器执行的任务。由IDE核心所使用的服务*IDE核心在注册被用于执行之前利用活对象仿真器来测试任务。IDE核心利用代理对象以便执行在真实活对象上的任务。该特征仅当此IDE核心可与该代理对象通过该中间设备通信之前使用,也就是,仅当PC机位于同一企业内部网上、或如果防火墙不限制中间设备口的数据包时远离家、以及可用的带宽允许时使用。提供给其它部件的服务*IDE核心仅是一个服务客户。代理仿真器责任仿真该活对象的代理以便允许本地调试和任务的执行。由该配置视图所使用的服务*提供给其它部件的服务*IDE核心将仿真器用于本地任务的执行及调试.任务登记责任基于浏览器的部件为学生提供增加或删除用于在基于无线电的PC机上执行任务的能力.由该配置视图使用的服务*任务注册服务器提供给其它部件的服务*开发该部件负责开发系统中所有的其它部件,尤其负责开发所有的代理对象及其相应的仿真器,并在必要时建立时这些对象。建立这些对象是有选择的,关于此事基本上有三个可选项所有对象都是同一类型,即,所有的对象都有同一个接口,而不管它们所代表的活对象。专用于一个特定的活对象的操作通过一个公共接口如“send-cmd”执行。这种方式的优点在于系统的开发、维护及配置都简单。其缺点是对于用户来说一个没什么意义的命令集,更重要的是,只有当在活对象上执行任务时才能检测到不正确的命令的使用,而不是在仿真器上或编译时才检测到。*在API级上所有对象都是同一类型,但每个对象都知道其自身的类型。在系统中所有的类型都驻留在一个库中。这样,从开发和维护观点看,这种方式又不简单,命令集的API仍无意义,但当任务在仿真器执行时能检测到错误。*不同的对象有不同的API来访问它们。这样系统的开发与维护就更不简单了,因为码是根据活对象的类型产生和建立的,而不是只被保存在一个库中,或根本不保存。但是该命令集对它的用户来说却有意义,而且,只要任务一被编译就能检测到错误。如此一来该方式就是较佳的途径。但是实施该方式却需要更多的开发努力,如此一来仅能以次级迭代来实施。任务和安全管理器数据模型图42-68包括描述任务和安全管理器数据模型的流程图.*用户*名称.*密码使用一种函数加密.*组用户所属的一个或多个组.*组*名称.*用户属于该组的零或多个用户.*角色与该组相关的零个或多个角色.*角色*名称.*许可根据下列条件*活对象类型.*活对象.*计算机.*定时器类似UNIXcrontab的能力.*任务*名称.*位置.*用户编写此任务的一个或多个用户.*执行时间何处及何时该任务将执行,必须匹配与该用户的组相关的角色。*活对象*名称*类型*主人*任务操作此活对象的一个或多个任务.*活对象类型*名称.部件描述安全管理器此安全管理器为其它部件输出两个主服务器。部件*配置授权负责建立用户、组、角色库,它所输出操作是远程操作,当管理员决定更新学生、组及角色的定义时就触发这些操作。该管理员使这些变化通过其基于GUI的控制台,该控制台利用上述的操作起到一个客户作用。*配置授权利用库中的数据,检查是否一个特定的操作是合法的。这种服务的客户是*任务管理器-无论何时当学生注册一个任务时,它就请求确认。*代理对象-无论何时当学生触发一个操作时,它就请求确认。任务管理器该任务管理器将系统中所有任务保存在一个库中,并据此向相应的无线电基站提供它们应该执行的任务。图42-68图示说明该情节,其中一个学生注册一个要执行的任务。她首先输入其用户及密码,然后安全管理器验证该学生。如果是许可的,则该学生获得所有允许的操作清单,即,获得具有下列操作的清单*增加任务*删除任务*更新任务*列出所有已注册的任务假定该学生决定注册一个任务用于执行,因此她选择“增加任务”操作。该任务管理器接收任务内容及任务信息,并且查询安全管理器该学生是否被允许注册一个具有特定任务信息的任务。如果是,任务管理器就注册该任务,然后通知该学生注册成功结束。任务规划器任务规划器负责规划所有已注册的任务,无论何时当一个任务的执行时间到达时,规划器就通知分配器应该下载该任务并产生(spawn)它。当规划器起动时,它重复通过所有的已注册任务的列表,并针对每一个SchedInfo对象建立一个包含本任务应起动和停止的下次时间的简单对象。该任务规划器根据所有已注册任务的执行时间保存它们的索引表,然后,无论何时任务的执行时间来到时,它在定时器中注册以接收事件。在接收到该事件后,它就通知相应的分配器应下载并执行该任务。任务分配器无论何时,当任务的起动时间来到时,任务分配器从该规划器获得一个已注册的任务,然后以独立的线程执行该任务。每个任务运行在灰箱内以便强化安全策略。下列状态图描述了该任务分配器。在图42-68中的一个图描述了系统中该任务分配器、任务规划器及其它组件中的数据流。任务规划器可从定时器中接收时间事件以及来自任务管理器中的taskListChange事件。该时间事件在任务的起动执行时间到达时产生。该事件触发了任务从规划器到分配器的下载和产生(spawn)。TaskListChange事件实际上改变了规划任务的清单,由此改变了定时器中的注册。管理控制台可以手动地浏览和改变正在执行的任务。下面描述关于首选的LOLA系统的总体考虑。LOLA(活对象实验室)是一个计算机班级,可使学生建立和体验称为活对象的自然人物(figure)的生动化。该生动化为活对象提供了以人声、似人和智能方式与人交互的能力。活对象实验室教给学生分析、设计和将“自然智能(NI)”编程进自然对象-活对象形象。由学生开发的NI随着时间增加和积累活对象与学生交互的能力。活对象形象分布到操场,并用作为对所有孩子们的娱乐和教育目的。自然智能自然智能是计算机化对象提供“类似人的行为”的能力,人尤其是年轻人非常能接受一直在变化的环境,这种技巧允许在与人的交互中有更大的自由。基于计算机的系统具有严格的交互协议,只要交流者(用户或另一个计算机化的机器)严格地遵循协议的规则,一个计算机化的机器的行为是高度可预测的并且非常精确。与该协议的偏离将导致交互的立即中止。计算机编程和基于计算机的机器被用于“解决问题”,当达到一个识别得很好的目标时该程序结束(暂停、或等待一个新的输入或事件),人的交互被定向于建立一个逐渐增加的共享理解。即使当最后的交互目标是解决一个问题时,每一步交互的“连续目标”是搜集和增加相应的信息至知识的集中池,这可在最后的目标到达之前来进行。在很多环境下,在交互开始之前是不知道最后的目标的,仅作为交互的结果而在以后标识出。将自然智能装进机器使得该机器可执行下列循环1、标识一种环境;2、对人作出应答;3、传送描述对该环境的累积或附加理解的信息;4、标识什么信息正在丢失;5、建议附加信息;6、请求附加信息;7、接收人的响应并分析它。LOLA的目标LOLA的首次实施是针对教育目的的高校,这些是该项目的高级目标*教授学生分析、设计以及将“自然智能(NI)”编程进自然对象。*友好并容易地使用该系统,来吸引学生学习高技术课程。*支持教师进行任务分配和评分。*作为基于内容的对象,取悦并提供信息给学生及教职员工。服务和他们使用情形的分析系统中的主要参与者是学生、教师、管理员和用户。该文档声明了系统的参与者的重要的使用情形,该使用情形被参与者以及服务编组学生、教师、管理员和用户。一个人可以作为一个或多个参与者而存在,尤其是,每个学生、教师和管理员同时又是用户,有可能同一个人可能既是教师又是管理员。系统中的主要部件是*编程基站每个基站包含IDE(集成开发环境),提供将NI编程进活对象的能力。在学生家中的计算机在安装了生成器IDE后也可以是这样的一种编程基站。*无线电基站每个基站与一个或多个活对象(通过RF通信)进行通信,并发送这些对象命令。*LOLA服务器主管LOLA系统中服务器(如任务服务器、安全服务器)的基站。*教师和管理员控制台在实验室中的基站,由教师和管理员分别使用。*活对象活对象是配备有控制装置的玩具。该控制装置包括微控制器、无线电发送接收器和I/O口,I/O口连接到同样包含在该活对象内的外设,如扬声器、麦克风、传感器、致动器、电机、灯、视频照相机等。这些外设可使该活对象能以人的方式与人打交道,外设由该微控制器操作运行,该控制器通过内置的发射接收器从基于无线电的PC实时地接收程序指令。随后介绍提供用于建立内部数据库的数据的另外两个次级参与者。提供用于建立内部数据库的数据的信息服务器支持来自学生任务的查询,一个内容提供商提供将被保存在内容服务器中的内容,这些内容将被规划成按所要求的执行。我们描述服务以及相关使用情形的分析。学生服务提供给学生(组建该活对象的行为的人)的主要服务在附图中加以说明。名称生成器IDE安装参与者如果安装在家里的PC机上则是学生,如果是安装在学校的PC上则是管理员。教师也可以将IDE安装在家中的PC上以便浏览其学生的任务。目标生成器IDE要被正确地安装。前后的影响1)可能先前已有安装,这时将对已有的安装进行升级。2)安装保护型安装3)学生一般使用Windows95/98,但也可能使用其它的环境如Macintosh、windows3.1/DOS、UNIX或NC(这时的安装将发生在服务器上)。触发器参与者从CD或一个下载文件起动安装。总结这种使用情形采用了第一个或稍后的生成器IDE安装1)要求参与者提供几个配置参数。2)参与者进到生成器IDE的正常使用。先决条件参与者下载该文件包或有一个CD。后条件生成器IDE已安装。相关使用情形应该随后立即生成或更新家中PC上的活对象,在用户方便时推迟到以后进行。名称增加家中活对象类型参与者学生如果教师在家中的PC上已安装了IDE,则教师也可能是这种情形的参与者。在此,管理员不是参与者管理员有单独的使用情形-处理活对象的更新。目标对于生成器IDE来说,系统中所有的活对象的类型都是已知的,以便为每种活对象类型支持一个仿真器。前后的影响1)信息源一般是安装在学校的LOLA系统,更新过程将是基于浏览器并通过因特网来完成,一个防火墙设置在家中的学生浏览器和LOLA系统之间。2)在学校,学生可以把所需要的数据放置在一张软盘上,然后将其安装在家中的PC上。触发器可以是下列触发器之一1)生成器IDE刚刚被安装。2)新型活对象已被连接到系统。总结生成或更新对于安装在学生的家中的IDE是已知的活对象类型。先决条件生成器IDE被安装。后条件1)在生成器IDE中的仿真器匹配可用的活对象的类型。2)学生可以着手建立一个决策树。相关使用情形1)生成器IDE安装2)LOLA安装名称建立一个决策树参与者学生目标建立一个准备复杂化的任务。前后的影响1)不需要编程知识2)容易使用且友好的GUI3)可再次应用以前任务中所做的决策树或子树。4)可使用内建的决策树或子树。5)学生想使用对其正在使用的玩具来说是高级的命令。触发器1)教师给学生分配作业。2)学生在实验室的上课期间或通过自由选择建立决策树。总结该使用情形捕获这样一种情况学生建立一个决策树以便将NT编程进一个活对象1)学生起动生成器IDE;2)学生建立一个决策树;先决条件1)准备复杂化的任务。相关的使用情形1)生成器IDE安装是所要求的;2)在家中的PC上生成或更新活对象类型是所要求的。名称建立一个高度定制的决策树。参与者学生目标建立一个准备复杂化的任务。前后的影响1)要求基本的编程技巧;2)易于使用编程语言和库;3)再次应用在先前任务中所做的决策树或子树;4)使用内建决策树或子树;5)学生想使用对其正在使用的玩具来说是高级的命令。触发器1)教师给学生分配作业。2)学生在实验室的上课期间或通过自由选择建立决策树。总结该使用情形捕获这样一种情况学生建立一个决策树以便将NT编程进一个活对象1)学生起动生成器IDE;2)学生建立一个决策树;先决条件1)生成器IDE安装在学生桌面上;2)仿真器仿真存在于学校内的活对象。后条件1)准备复杂化的任务。相关使用情形1)生成器IDE安装是所要求的;2)在家中的PC上生成或更新活对象类型是所要求的。名称编译一个任务参与者学生目标产生一个准备在活对象上执行的任务,并根据由该学生建立的决策树而动作。前后的影响1)学生不必对该决策树的内部实现熟悉;2)如果该学生只建立了一个决策树,而没有增加学生定义的宏/码,则希望该复杂化过程能通过大多数情况。3)通过观察决策树应能显示复杂化的错误/警告。只有在学生增加宏的情况下,这些行也被显示。4)友好、易于使用。触发器1)学生已建了一个决策树。总结该使用情形捕获这样一种情况学生建立了一个决策树并想编译它。1)学生起动生成器IDE2)学生建立了一个决策树;3)学生编译该任务。先决条件1)学生已建了一个决策树。后条件1)如果复杂化通过-一个任务准备执行。相关的使用情形1)建立一个高度定制化的决策树或建立一个决策树是所要求的。名称执行一个任务参与者学生目标学生PC上本地执行一个任务以便检查它,该对象与一个驻留在学生PC机上的活对象仿真器进行交互,或者如果可能的话,与一个连接到学生PC或网络中其它PC上的自然对象进行交互。前后的影响1)活对象仿真器应精确地仿真一个自然对象的行为,尤其是,它应当指出当此任务单独地在一个活对象上执行时可能发生的所有任务;2)作为一个生成器IDE的集成部件看待;3)友好、易于使用;4)安全在学生试图执行连接到一个远程PC的活对象上的任务时检验该学生的许可权利。触发器1)学生建立和编译一个任务并希望执行它。总结该使用情形捕获这样一种情况学生建立了一个决策树并想立即运行它,一般地以便检查该任务。1)学生起动生成器IDE;2)学生建立一个决策树;3)学生编译该任务;4)学生执行该任务。先决条件1)一个任务准备在一个活对象上执行。相关使用情形1)建立一个高度定制化决策树或建立一个决策树或编译一个任务是所要求的。名称调试一个任务参与者学生目标在学生PC上本地调试一个任务,该任务与驻留在学生PC上的活对象仿真器进行交互,或者可能的话,与一个连接到该学生PC或网络中其它计算机上的自然对象进行交互。前后的影响1)活对象仿真器应精确地仿真一个自然对象的行为,尤其是,当此任务与该活对象单独地执行时它应能指出发生的所有错误;2)作为生成器IDE的集成部件看待;3)友好且易于使用;4)如果学生在一个连接到如远程PC的活对象上执行该任务则进行安全检查。5)学生可以按步骤地跟踪任务的执行,并可以图形方式观察决策树中哪一个点正在被执行。6)学生可以进入代码行调试,以增加决策树;7)一般的调试能力如步入、步出、进到光标处、设置断点、继续、观察设置点等。触发器学生建立并编译一个任务,并希望调试它。总结该使用情形捕获这样一种情况学生建立了一个决策树并想调试它。1)学生起动生成器IDE;2)学生建立一个决策树;3)学生编译该任务;4)学生调试该任务。先决条件1)学生建立了一个决策树。后条件1)一个任务准备好在一活对象上执行。相关使用情形1)学生建立了一个高度定制化的决策树或建立了一个决策树并编译该任务是所要求的。名称任务注册参与者学生目标该任务被正确地安装,并当规划时运行。前后的影响1)通过因特网或企业内部网的基于浏览器的注册;2)安全、保密;3)防火墙驻留在基于网站的客户和该服务器之间。触发器学生起动注册过程,一般地是在她已建立、执行和调试一个任务之后。总结该使用情形可以保证学生注册了一个用于执行的任务。1)请求学生的用户名和口令;2)请求学生发送任务文件;3)学生可以浏览所有他已注册的任务,并执行其它的操作如删除先前注册的任务。先决条件学生已建立、执行和调试了她的任务。后条件任务被注册成按规划的执行。相关使用情形1)调试或执行一个任务。名称浏览任务的执行日志参与者主要参与者是学生,教师和管理员也可以是这种情形下的参与者,一般是帮助解决问题的。目标浏览已执行的任务的日志,一般是为了诊断问题。前后的影响1)学生可以从连接到该企业网的每个PC上浏览该日志;2)通过因特网的基于浏览器的日志浏览,其中,防火墙驻留在家中PC和LOLA系统之间是较好的特点;3)学生可以根据几种条件浏览日志。触发器1)学生的任务已执行,学生想浏览该执行的日志。总结这种使用情形捕获了这样一种情形学生已建立了一个决策树,并将其登记用于执行,并想浏览该执行的日志。1)学生起动生成器IDE;2)学生建立一个决策树;3)学生调试该任务;4)学生注册该任务;5)学生浏览该执行的日志。先决条件1)学生已注册了一个任务,且该任务已被执行。后条件1)学生理解她的任务是如何被执行的。相关使用情形1)注册任务是所要求的。教师服务教师负责任务分配、检查及评估的各个方面。名称浏览学生任务参与者教师目标浏览学生的任务以及对其任务进行评估或帮助解决问题。前后的影响1)安全、策略-只有教师可以浏览学生的任务;2)教师可浏览每一个注册的任务;3)教师使用生成器IDE作为任务浏览器;4)根据配置,教师可以或不可以改变学生的任务。触发器教师想评估她的学生的任务或帮助她们解决问题。总结1)教师起动生成器IDE;2)教师登录进入任务管理器;3)教师从该服务器装载一个任务到她的IDE。先决条件1)生成器IDE安装在该教师的桌面上。后条件1)学生任务出现在教师的控制台上。相关使用情形生成器IDE的安装是所要求的所执行任务统计的使用情形也可用作为一个措施以评估学生。名称所执行任务的统计参与者教师目标教师浏览关于学生任务的统计,以便评估他们的工作。前后的影响1)安全、保密-只有教师可以浏览学生的任务;2)教师可以浏览有关其学生的每一个任务的统计。触发器1)教师想评估她的学生的工作。总结1)教师登录进入统计服务器;2)教师从该服务器查询数据,并浏览该数据。先决条件学生任务已在系统中执行。后条件教师有更多的措施来评估其学生。相关使用情形浏览学生任务的使用情形也可以作为评估学生任务的措施。管理员服务管理员负责系统的安装、开发、维护、诊断、监视及控制。名称安装参与者管理员目标该LOLA系统将被正确地安装。前后的影响1)应用组件应该以这样一种方式开发不会产生瓶颈,系统将以有效的方式运行;2)安装过程可以从中央位置来完成;3)先前可能已有安装,在这各情况下,安装将是更新先前的版本;4)类似安装的安装保护;5)系统应被调整成支持十个活对象和成百个学生。触发器管理员从CD或一个下载的文件上起动安装过程。总结这种使用情形捕获了系统的第一和稍后的安装1)询问管理员几个配置参数;2)管理员进而更新活对象的使用情形。先决条件管理员下载文件包或有一个CD。后条件设置用于定义活对象类型的所有东西。相关使用情形1)更新活对象类型立即随后进行,也可以延迟到用户方便的稍后时间。名称增加活对象类型参与者管理员目标系统中所有活对象的类型和对象对于该系统来说都是已知的,并据其来开发相应的应用组件。前后的影响1)从一个中央位置来进行;2)活对象和对象类型在其生命周期内可以从系统中增加或删除,而不只是在安装后。3)尤其是,驻留在学生家中的PC上的IDE内的仿真器应被更新。触发器1)LOLA系统已经被安装了;2)活对象的新类型已被连接到该系统。总结根据可用的活对象来配置系统。先决条件系统的安装后条件在系统中所有活对象的类型是已知的。相关的使用情形1)安装2)触发在家中PC上生成或更新活对象类型的使用情形。名称学生、组和角色定义参与者管理员目标学生可登录进该系统,并根据他们的权力许可执行某些动作。前后的影响1)灵活性-学生可以属于一个或多个组,并且每一个组可以有一个或多个角色,同一角色可被分配到几个组;2)该过程可以在安装或活对象的配置后进行,以及在无论何时新的学生、组或角色应当被增加或删除的有规律的基础上;3)用户的定义独立于系统用户。触发器教师请求管理员打开到他的学生的帐户,以便他们开始应用该系统。总结该使用情形捕获这样一种情景一个班的教师希望她的学生被授权使用该系统。1)管理员定义角色每个角色定义包括角色名称和角色的所有者被赋与的许可权,许可权可根据下列条件来授予*活对象类型;*活对象;*次数类似UNIXcrontab的能力;2)管理员定义组每组的定义包括组名、与该组相关的零个或多个角色;3)管理员定义用户每个用户定义包括用户名、密码(用一种函数加密)以及零或多个与该组相关的角色。先决条件1)安装;2)更新活对象类型。后条件学生可以根据他们的许可权登录进该系统。相关使用情形1)安装和更新活对象类型是所要求的。名称诊断、监视和控制系统。参与者管理员目标该参与者能诊断、监视和控制系统。前后的影响1)在可能时能检测到潜在的问题;2)通过诊断工具分离该问题;3)通过正确的措施解决该问题;4)自动进行全面检查;5)允许管理员定义针对某些事件的自动动作,例如,根据所接收到的特定的时间事件改变此RF信道;6)管理员可以触发对活对象的操作,并以一种联机的方式从该处接收事件;7)管理员可以浏览系统中的所有事件;8)基于浏览器的管理控制台;9)安全;10)与企业管理控制台(如果有的话)集成。触发器在有规律的基础上,或在学生或教师提出问题后,对系统的管理。总结1)管理中起动基于浏览器的管理站;2)管理员诊断、监视和控制系统。先决条件1)系统已被安装。后条件系统运行正常。相关使用情形1)安装;2)浏览和改变任务的规划时间。名称浏览和改变任务的规划时间。参与者管理员目标从一个中央位置或通过对整个系统的观察控制任务的执行时间。前后的影响1)从任务规划中滋生的潜在问题应当在可能时事先检测到;2)管理员应能看到系统中所有任务的规划时间;3)管理员应能改变任务的规划时间或能规划用于执行的未规划任务;4)安全性。触发器1)学生刚刚注册了用于执行的任务,管理员希望验证学生们恰当地规划了他们的任务。注意学生仅能根据他们的许可权力注册任务。但是他们仍可能不恰当地注册了任务-如-如果两个或多个在同一活对象上注册了任务,且次数重迭,那么这些任务将作用在同一传感器上;2)学生们已经注册了任务,但没有声明规划时间,一般地,因为管理员想避免冲突而自己声明它,这样,管理员声明了所有任务的规划时间;3)任务已经从一个因特网上的内容提供商服务器处下载,管理员想规划这些任务用于执行。总结1)管理员起动基于浏览器的管理站;2)管理员浏览系统中的所有任务和它们的规划时间(如果已规划的话);3)管理员改变任务的规划时间或规划用于执行的新的任务。先决条件1)系统已安装;2)任务已注册在系统中或被下载进系统。后条件任务被规划成按所要求的执行。相关使用情形1)安装;2)诊断、监视和控制系统。用户服务该用户可以是操场内与该活对象进行交互的任何人,尤其是,可以是一个学生、教师、管理员或一个都不是。名称与活对象进行交互参与者用户目标交互的目的可以娱乐、教育、任务检测(学生或教师)、系统检测(管理员)。前后的影响1)友好地交互;2)活对象按照所注册的任务而运行规划这些用于执行的任务的规划器。3)用户看见操场内的活对象并决定与之交互。总结该使用情形捕获这样一种情形一个用户与一个活对象进行交互,用户通过语音(听或与之交谈)、观察其反应或触发其传感器而与该活对象交互。先决条件一个或多个任务与该活对象一起执行。后条件一个或下列中的两个1)娱乐该用户,更多地是教育;2)利用一个自然对象(学生或教师)检查该任务;3)已检查了活对象的功能性(管理员);相关使用情形1)执行一个任务;2)调试一个任务;3)任务注册。内容提供商服务与该系统交互的外部服务器,以便将数据推进(push)LOLA数据库,或根据来自一个LOLA客户的要求提供这样的数据。名称建立内容数据库参与者内容提供商目标拖出(pull)或提供将在活对象上运行的任务(内容)。前后的影响1)支持为LOIS系统所开发的能力;2)内容可以在有规律的基础上自动地被推进,或根据请求被拖出来;3)由该内容提供商所写的任务以与学生所写的任务相似的方式被规划执行;触发器取决于下列配置1)一般地,管理员将配置推进客户以便在特定的时间间隔上运行更新,因此触发器是推进客户触发器;2)管理员可以手动初始化一个下载。总结该使用情形捕获这样一种情景学校的管理员想要规划由内容服务商提供的要执行的任务,并在有规律的基础上更新这些任务,这些任务是以一种与学生所写的任务相似的方式进行规划执行。所有的使用情形支持动作,如注册、付帐,内容提供商被认为是LOLA系统的一部份。先决条件1)已安装了LOLA系统;2)安装和注册使用LOIS系统的情形。后条件1)准备用于执行的新任务驻留在任务数据库中。相关使用情形1)安装信息服务器服务外部服务器与该系统交互以便将数据推进LOLA数据库,或者根据LOLA客户的请求提供这样的数据。名称提供信息以建立支持学生任务查询的数据库。参与者信息服务器目标推进或提供用于学生数据库查询的数据。前后的影响1)使用标准工具或协议以建立这样的数据库;2)数据可以在有规律的基础上自动推进,或有请求时被拖出来。触发器取决于下列配置1)一般地,管理员将配置该推进客户以便在特定的间隔上运行更新,因此触发器是推进客户规划器;2)管理员可以手动地初始化一个下载。总结该使用情形捕获这样一种情景学校的管理员想建立一个学生可查询的内部数据库,而不是在网页上搜索想要的数据。先决条件已安装了LOLA系统。后条件1)数据库被更新。相关使用情形1)安装图42是一种情感相互作用流程图设计过程的简化流程图说明。图43-102说明根据本发明一个优选实施例构筑和工作的一种计算机化编程教学系统的一些优选实施例。现在详细说明图69-102。图69是该系统网络的一般逻辑全貌图,其中,各个服务器(例如数据库服务器316和创造物控制服务器318)位于中央,而学生编程工作站310、教师站312、管理员站1200和无线电基地站320则聚集在各服务器的周围。图70是对创造物322的控制的一般逻辑全貌图,其中,无线电基地站(它向各种创造物提供控制)位于中央,而学生编程工作站310、教师站312、管理员站1200、和无线电基地站320则聚集在各服务器的周围。图71是管理员站的主菜单,其中包括4个主要的子菜单关于系统操作的“实时信息”1250,用于寻找硬件和软件的问题的“诊断”1260、软件和硬件的“配置和记录”1270,以及用来调度和管理由学生提出并由系统执行的各种任务(项目、程序)的“任务”1200。图72说明在家里建立和测试一个任务(项目、程序)的一些基本步骤。首先,学生建立任务(步骤1290),然后编译源码(步骤1300),然后利用仿真器执行任务(步骤1310),如果任务未能按其设计要求执行,则学生将利用仿真器为程序找错,找出问题,进行改正,然后重新测试任务(步骤1320)。如果任务能按设计要求执行,则学生将记录该任务(步骤1330),准备对一个物理创造物执行。图73说明学生在家里和学校里建立,测试和记录一项任务的处理过程。该过程以家里的学生开始,与图62类似,不过这里学生将把任务转移到学校,并在学校里继续同样的过程。图74是说明一个非常简单的“决策树”(也称为“状态引擎”)的流程图,该流程图教导创造物进入“聆听横式”于是记录用户发出的语声并利用语言识别引擎处理这个记录。聆听模式一直持续到识别出词语“清醒”,点明任务是唱出一首歌曲。当完成歌曲之后,处理过程将重复进行。图75是说明仿真引擎主要功能的方框图。仿真引擎使学生能在不存在物理创造物的情况下测试所建立程序(任务)对物理创造物的有效性。仿真引擎利用一些标准计算机周边设备来提供物理创造物的所有物理功能例如用计算机话筒模拟创造物的聆听功能1450,用计算机扬声器模拟创造物的说话功能1460,用在计算机屏幕上显示创造物的动作来模拟创造物的运动1470,用计算机键盘和鼠标来模拟创造物的传感器1480,以及用计算机显示器和周设摄像机来模拟安装在创造物中的视频显示器和摄像机。图76是说明对一个项目(任务)的记录和执行的处理的流程图。在步骤1500中,学生或教师把任务记录在数据库服务器(LOLA服务器)316中,供以后借助于一个特定创造物控制服务器318和一个特定创造物324来执行,在步骤1510中,根据在记录步骤1500中所规定的日期、时间或其他条件,LOLA服务器316把任务传送给相应的创造物控制服务器318执行。创造物控制服务器通过利用无线电基地站320把命令发送给相应的创造物324来发出程序和执行程序。图77是教师们能得到的一些主要服务的方框图。教师可以访问IDE的唯一扩展形式(步骤1600),以选择和检查每个学生的每项任务(步骤1610)。教师能够浏览学生的任务(1620),观看关于任务的执行的统计情况(1630),例如绝对性能统计(1640)和相对性能统计(1650),以及给学生打分(1660)。图78是活对象实验室(LOLA)系统拓扑结构的方框图,其中包括以下一些主要子系统LOLA服务器,其中含有一个或几个服务器,例如数据库服务器和创造物控制服务器,管理员站1710;教师站1720;学生编程站1740和无线电基地站1750。除了无线电基地站之外,所有主要子系统都由网络手段互联,其中网络手段例如有超文本传送协议(HTTP)或中间件(MW),其中的中间件可以是任何适当的接口软件。典型地,除了无线电基地站之外,所有子系统都通过一个例如以太网(Ethernet)这样的局域网(LAN)互联,而无线电基地站则由万能串行总线(UniversalSerialBus,USB)连接。图79是活对象实验室(LOLA)系统的一个方框图,其中示出了该系统所提供的一些主要(逻辑)服务数据库引擎1760管理对数据库1765的所有访问。登录服务器1770登录在系统中运行的所有创造物和任务的执行情况和性能的细节。监视器引擎1775实时地向用户提供在监视时间上系统所执行的任务的性能的信息。安全管理器1780监督所有访问该系统的用户,并根据管理员预定的条件确认只有被授权的用户才可以访问数据库的某些特定部分。任务管理器1785根据被授权用户所提出的规定来监督系统中所有任务的操作,典型地,这些服务由一些独立的软件子系统提供,这些子系统通过HTTP和MW等普通通信手段相互连接。图80是系统管理员利用系统管理员站1200可得到的一个些主要服务的方框图。典型地,这些服务包括在线控制台1800,用于当系统工作正常时对所有可得到的服务的控制。脱机控制台1810,用于当系统因进行重大安装和维修而关闭时对所有可得到的服务的控制。配置控制台1820,它使系统管理员能装设硬件周边设备,建立网络配置等等。调度控制台1830,它使系统管理员能设置新的创造物或改变已有创造物的配置。图81是创造物控制服务器软件的主要模块的方框图,其中的创造物控制服务器可以是一个独立的服务器,也可以是例如总LOLA服务器这样的另一个服务器的一部分。创造物控制服务器由许多代理对象1840组成,每个代理对象负责一个特定的创造物和一个计划器任务,该计划器任务负责各种代理对象的操作的协调和时序。图82是学生利用编程站可得到的一些主要服务的方框图。这些服务以一些通过例如HTTP和MW等接口互相连接的模块来实现。三种主要的模块/服务器是交互作用开发环境(IDE)1860,它使学生能进行对指定给他(她)的作业(任务)的编程;仿真器1870,它使学生能利用在计算机屏幕上模拟的虚拟创造物来测试所建立的程序;以及任务记录器1880,它使学生能把所建立的程序记录下来,供物理创造物执行。图83是教师利用教师站能得到的一些主要服务的方框图,除了另外有一个教师控制台使教师能给学生指定任务(作业)并监视他们的完成情况和打分等等之外,这些服务及其模块式结构与编程站的是相同的。图84至93一起构成了对LOLA的一个演示性示范项目的总体说明。图84是一个示范性LOLA的方框图,其中含有两个班级,每个班级有5个编程站、1个教师站、一个直接连接在网络上的无线电基地站和一个创造物。此外,在两个班级之外,还有一个LOLA服务器、一个管理员站和一个也是直接连接在网络上的无线电基地站,该基地站控制着4个创造物。图85是说明安装该示范性实验室的方法和功能的方框图,它在管理员级别上和两个班中使用。图86和87说明该示范性系统的软件和硬件的结构。图88至90是说明激励该示范性项目的演示程序的步骤的流程图。图91说明该示范性系统的一些主要应用模块。图92和93说明为使该LOLA系统工作所需采取的步骤。图92列出为激励示范性演示软件所必需安装的一些软件模块。图93列出为了在能执行图88和89所示的活动之前必需进行的配置活动。只要所有步骤都能完全地执行,它们的执行次序并不重要。图94至105说明交互作用式开发环境(IDE)的结构和特性。图94示出IDE屏幕的典型结构。该屏幕的典型组成是如所有Windows(视窗)应用所共有的一个顶部菜单条2000和一个底部状态条2005;例如2010和2020等工具条,它们可设置在屏幕上任何处,图中示出的是在靠近顶部菜单条处。工具条2010中含有编程人可得到的各种软件工具的图标,例如编辑、编评、仿真等的图标。编程工具条2020中含有编程人可以列入软件程序中的各种目标的图标,例如状态、事件、功能等的图标。可以从工具条中拉出一个目标放入编程窗2030,以与该窗内的其他目标连接。当选出一个目标时,在目标检验窗2040中将显示出该特定目标的性质,编程人可以修改这些性质的值,以生成所需的程序行为。当选择了“仿真”时,将在仿真窗2050中显示出被编程创造物的模拟像。当指令该创造物收集输入数据(语音或触觉传感器)时,将跳出一个菜单2060,于是编程人可以通过该跳出式菜单中作出适当的选择来与创造物相互作用。消息窗2070在编程过程中将向编程人提供提示,在仿真过程中将向编程人提供程序执行的跟踪数据。图95示出编程人可得到的一些主要功能(文件、编辑、观看等)和一些子功能,主要功能显示在IDE屏幕的顶部菜单条2000中,子功能是在选择了一个主要功能后在一个下拉式窗口中示出的。图96A和96B示出用户可以目标工具条2010和编程工具条2020中得到的一些主要目标和编程工具。图97更详细地说明了目标检验窗2040。图98说明各种情况下在消息窗2070中向编程人显示的一些主要消息组。这些消息组是编程句法错误,编译错误,例如编译,找错等各种功能的进程说明消息,系统在找错时提供的测试登录消息。图99是仿真处理和模块结构的方框图。当“仿真”被激活时,IDE模块2200将执行被测试的程序,只是把创造物能执行的指令发送给了虚拟创造物命令接口2210。接口2210识别创造物类型,并且被仿真的相应创造物功能将选择和操作相应的功能2220,功能2220在计算机显示屏上执行虚拟创造物的相应动作2230。图100说明底部状态条2005的结构。图101A至101D更详细地说明当选择了一个目标组时各种目标组的目标工具条2020的内容和结构。图101A是图96A中2100的详细情况,图101B是图96A中2110的详细情况,图101C是图96A中2120的详细情况,图101D是图96A中2130的详细情况。情感分析概念性说明活对象实验室LOLA的目的是教导学生把人类行为灌注到计算机化的机器中去的技术。人类的一个主要特性是能感知情感。也就是说,能识别另一个人的情感状态和状态改变并作出相应的反应。向人类教导情感感知是十分困难的,而要把情感感知植入到机器中去则更要困难得多,然而,当机器具有即使是简单的情感感知时,也会对人机交互作用有巨大的作用。因此对情感感知的编程是重要的。情感分析的主要目的是给主要应用以能适应与机器交流的人的情感状态的能力。情感分析是一种背景处理。情感分析评估与活对象交流的人的情感状态。这个评估是与其他处理并行地连续进行的。按照应用系统的复杂程度和编程的难易程度,该处理可以作为一个被主处理调用的子程序或作为一项背景任务来执行。主要模块(或处理)的对象是应用的主要目的(例如扮演教师、保护人、响导、玩件等角色)。情感分析与主要任务通信,接收必要的输入,并向主要应用提供一系列应对与之交流的人作出的适当反应。情感分析大部分是语言上的。情感分析处理将分析由主要应用所记录的语言输入内容。根据分析结果,情感分析将向主要应用提供适当的数据。由情感分析处理向主要处理提供的数据可以从相互作用人的可看到的情感状态或情感状态改变一直到准备让主要处理放送的详细语句。向情感分析提供的输入和是否遵从情感分析的输出,其最终决策在于主要(应用)处理。情感分析基本上是一个程序,它可以用与编制主要应用相同的现成编程工具来编程。情感分析程序可以看作是一个实现成状态引擎的算法,该引擎中的事件是从与使用人的交流中接收到(记录下)的语言输入的语音分析和语义分析以及所积累的数据的结合。情感分析处理的设计涉及到几个阶段,例如确定情感的种类范围,例如三种情感悲伤、快乐和愤怒;确定准确在从与使用人的交流中接收到(记录下)的语言输入中探测出的情感的语音和语义表示,例如,语声幅度(轻声或高声)、语音的音调、语速、收录质量(语言识别质量)、和特定语词(如“悲伤”、“快乐”、“愤怒”)。当然,上述某一特征的变化可能会比该特征本身更重要,例如,提高声音可能比连续的高声传递更多的情感信息;确定明确地询问交流人的情感的方法,例如直接提出“你悲伤吗?”这样的问题;根据所探测到的交流人的情感状态,确定对应用的相互作用所进行的修改。应该首先确定修改的目的,然后再确定方法。其中,修改目的的例子有表达同情,提供情感支持和鼓励等,以及影响(改变)情感种类;方法的例子有采取适当的语言输出幅度(响度)、调门、和速度,准备要选择和放送的同一语言内容的几种版本,表达同情、感兴趣、支持等的约定/标准短语;确定应用处理与情感分析处理之间通信方法(协议)。给学生的编程项目打分通常,教师根据一个检查清单来评估考虑和打分。对于从精确的科学直到人类学等所有的命题考试都是这样来评估和打分的。对于编程(从分析、设计、到实施)的评估来说也是这样做的。检查清单评估可以自动进行,也即由计算机进行。由于对考卷的计算机评估的机制是很普通的,并且对所有命题考试都是一样的,所以这已不属于本文的范畴。编出的程序还应该能正确地运行,也就是说应能符合规定要求不出错(不失败)地靠其自身运行。显然,计算机能够跟踪被运行程序的性能,根据规定分析其性能,和报告结果。自动(或计算机)评估通过一个监视程序来实行,该监视程序能记录被监视程序的性能,分析记录,和报告结果。为了实现监视,在被监视程序中需设置一些检查点,并且监视程序应同时记录通过每个这种检查点的情况和相应的参数值。LOLA的约定监视将提供对每个状态的入口和出口(从而提供对每个状态改变/连接的入口和出口)。监视程序应报告对每个学生的每个程序模块的监视结果。可以根据以下一些标准来打分已进入的(从而已测试过的)的状态和状态连接的百分比;已退出的(从而表明已成功运行的)状态和状态连接的百分比;内部性能的平衡情况,它是两个数的比值,第一个数对最少访问(最多访问)的实体(状态、连接)的进口(出口)数,第二个数是模块(每个模块和各个模块)内的平均入口(出口)数。更精确地说,平衡情况是清单中各入口(出口)和各最多访问实体与平均值之间的差值的平方和的平方根;总体性能平衡情况,它是模块中的进口(出口)数与项目的平均数的比值。图103是说明情感分析数据库的一个表格。图104是一个情感分析状态图。情感分析设备能探测到用户情感状态的变化。情感状态的变化与用户语言特征的变化有关,这些特征例如有响度、速度、音调(以下是隐含特征的例子)以及用户所使用的特定词条和对创造物所提出的直接约定问题的回答(以上是显特征的例子)。每个这种特征事件都有一个权重,当发生某一事件时将在相应的表格单元中增大权重。仅当超过某一阈值时创造物才会对探测到的状态变化作出响应(提供同情,提出一个约定的问题等)。图105-110说明Uniport(单端口)的一个优选实施例,其中包括了一个软件体系的总貌。图105示出一些典型的功能调用和返回说明。图106示出适用于媒体BIOS模块的典型输入数据处理。图107示出适用于UCP实现模块的典型输入数据处理。图108示出适用于用户应用和API模块的典型输出数据处理,图109示出一个典型的UCP实现模块和媒体BIOS输出数据处理。图110示出协议实现模块和媒体BIOS模块的输出数据处理,在图110中,MAX-OB代表输出缓存器中各单元的最大值。下面是一些典型输出功能的说明crsrAddWords这个功能用来从语言识别引擎向活动正文添加词条。crWaitForEvent这个功能用来等待来自UNIT的事件。bioTransferReset这个功能用来复原Media(媒体)BIOS模块中的输入或/和输出队列(见图5,2)。关于3.2协议实现模块的输出功能的说明。proSystemOpen这个功能用来打开系统。proSystemeLose这个功能用来关闭系统。proSendMessage这个功能用来发送控制消息。proSendBuffer这个功能用来发送缓存。proTransferReset这个功能用来复原MediaBIOS模块中的输入或/和输出队列。关于3.2API模块输出功能的说明。crBaseDetect这个功能用来探测BASE(基地)(确定装置的识别符ID)。crSystemOpen这个功能用来打开系统。crSystemClose这个功能用来关闭系统。crSetNotification这个功能用来设置用户应用中的回呼说明机制。crSendBuffer这个功能用来发送缓存。crSendMessage这个功能用来发关消息。crUnitTalk这个功能用来放送声音文件。crGetBaseVersion这个功能用来从BASE获得版本号。crsrGetWords这个功能用来从语言识别引擎的有效正文获得所有词语。crsrCreateContext这个功能用来在语言识别引擎中生成新的正文。crsrDeleteContext这个功能用来在语言识别引擎中删除正文。crsrSelectContext这个功能用来从语言识别引擎选择正文。crsrRemoveWords这个功能用来从语言识别引擎的有效正文去除词语。关于3.1Media(媒体)BIOS模块输出功能的说明bioMediaConnect这个功能用来连接到通信媒体上。bioMediaDisconnect这个功能用来断开与通信媒体的连接。bioAddOutBuffer这个功能用来把输出缓存添加到输出队列上(见图5)。图111-115一起构成了玩具配置的流程图。图111说明典型的人物(figure)配置。图112-115说明典型的安装-检验(分别为BT的四之一、四之二、四之三、四之四)。为了产生一个屏幕接口,可以记录下述用作屏幕文本的带声voice-over内容屏幕0010-0012进入前言早上嗨,早上好!下午嗨,不错吧,下午好!晚上嗨,晚—安!屏幕0040关于你(ABOUTYOU)叩击这里以给出或改变用户信息。屏幕0050热叩击!(HOTCLIP!)叩击这里可看到说故事人跳舞和唱歌。屏幕0600如何玩(HOWT0PLAY)叩击这里可听到教你如何玩。屏幕0070起动游戏(PLAY)叩击这里可以开始游戏。屏幕0080**新检查(**NEWCHECK-UP)叩击这里可以检查系统。屏幕0090退出(EXIT)叩击这里可以关闭说故事人程序。屏幕0041双击用户名或键入新用户的姓名。如果是键入新的姓名,则键入完后按“ENTER”键。屏幕0042请键入新用户的姓名。键入完后按下ENTER键。屏幕0043当我们一起玩时,我将用一个秘密名字来叫你。现在请双击你想要的秘密名字。当他们没有选择秘密名字时我必须首先知道你的秘密名字。现在赶快选择一个秘密名字。关于你(ABOUTYOU)叩击这里以告诉我有关你的一切。填写个人数据的说明1、叩击位于某一项处的光标。2、将呈现一个菜单。作出你的选择。3、逐项地重复上述过程。4、完成后叩击主菜单(MAINMENU)钮。在“关于你”(ABOUTYOU)/“秘密名字”(AECRETNAME)/“爱好”(FAVORITES)屏幕顶部的关于输入数据的一般邀请请告诉我关于你的一切。我很乐意了解你。爱好(FAVORITES)叩击这里来选择你爱好的事物。·你喜爱什么颜色?黄?红?蓝?选一个。·你喜爱什么食品?比萨饼?通心粉和奶酪?炸薯条?选一个。·你喜爱什么活动?玩骗人相信?画画?玩计算机游戏?选一个。你喜爱什么动物?猫、狗、马?选一个。光标图(GRAPHICOFCURSOR)叩击这里以返回“说故事人”的主菜单。应该看到,如果需要,本发明的软件部分可以用ROM(只读存储器)的形式的实现。一般,如果愿意,软件部分可以用普通技术以硬件的形式实现。应该看到,附录中所说明的具体实施例只是为了提供本发明的一个极详细的公开内容,而不是为了限制本发明。应该看到,为了清楚而在各个分开的实施例的说明文中说明的本发明的各种特征也可以结合在一个实施例中给出。反之,为了简短而在一个实施例的说明文中说明的本发明的各种特征也可以完全分开地说明或组合成任何适当的子组合来说明。附录A应用源代码<prelisting-type="program-listing"xml:space="preserve"><![CDATA[===============================  Copyrignt(c)1995-1998CreatorLtd.AllRightsReserved================================DescriptionThisistheMainunit.unitMain;interfaceusesWindows,Messages,SysUtils,Classes,Graphics,Controls,Forms,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,Forms,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,Forms,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,Forms,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,Forms,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,FieldNumber]  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,FToyNumber);  CloseFile(F);except  SaveConfiguration;end;end;procedureTPDBEngine.SaveConfiguration;varFTextFile;beginAssignFile(F,DatabasePath+′Configuration.CRE′);Rewrite(F);  Writeln(F,FToyNumber);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,FMultiToy1);Readln(F,FMultiToy2);Readln(F,FMultiToy3);Readln(F,FMultiToy4);Readln(F,FMultiToy5);Readln(F,FMultiToy6);Readln(F,FMultiToy7);Readln(F,FMultiToy8);CloseFile(F);except  SaveConfiguration;  end;end;procedureTPDBEngine.SaveMultiToys;varFTextFile;beginAssignFile(F,DatabasePath+′MultiToys.CRE′);Rewrite(F);Writeln(F,FMultiToy1);Writeln(F,FMultiToy2);Writeln(F,FMultiToy3);Writeln(F,FMultiToy4);Writeln(F,FMultiToy5);Writeln(F,FMultiToy6);Writeln(F,FMultiToy7);Writeln(F,FMultiToy8);CloseFile(F);end;end.================================  Copyright(c)1995-1998CreatorLtd.AllRightsReserved================================Description;ThisisthePestoSongunit.unitPestoSong;interfaoeusesWindows,Messages,SysUtils,Classes,Graphics,Controls,Forms,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,Forms,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,FavoriteColOrstring;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,Forms,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,Forms,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,Flags);  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,Flags);  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,Forms,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,FIFO8KBM.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=Y6PAT63TYCTPOKY!;|||||||SelectXTOscil=01=04MHZ;====|||||++------>SelectHSOscil=10=10,20MHZ;|14.7MHZ|=′10′||||+-------->WDTDisabled;====|||+--------->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=Year(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[USER]=8KHZ,Presc=14000/(4*8)-1=124!!!TOY4MHZRF!;14.7456MHZ,F[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′;!!!PR2>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...?!!COHMEQU4;1HUB(HBYTE)->PCACKorSTATUSCOHMRFEQU3;1TOY-HUB->PCACKorSENSOR(STATUS)fromTOYADSMEQU2;1A/DSable-FIFO->HBYTE-UART->PCRFTXEQU0;1RFTX/0RFRXifCOPW=COHM=COHMRF=0NotPWM&amp;COHMFRFEQU25;RFFlags!!ToBeginRFFRF(,_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(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,FE(#FF),00,..TSTPWEQU1;1TESTPC->HUB00,01,..FE,FE(#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=YesACK/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,FR=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=YesFFh.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!!!;BMTforPC-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;!!BANK1![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,FIFO8KBM.Kholodorg0004hGOTOINTHANDLERR;---------------------------------------------------;******ROMConstants******;---------------------------------------------------PLLSetDFclrfPCLATH;Shouldbeinpage0ADDWFPCL,FNOPNOPRETLWPLLDR1HRETLWPLLDR1LRETLWPLLDR2HRETLWPLLDR2LRETLWPLLDR3HRETLWPLLDR3LRETLWPLLDR4HRETLWPLLDR4LRETLWPLLDR5HRETLWPLLDR5LRETLWPLLDR6HRETLWPLLDR6LRETLWPLLDR7HRETLWPLLDR7LEncodeTable;RFMessageEncodingTableclrfPCLATH;Shouldbeinpage0addwfPCL,FretlwB′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;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;(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,FGOTOPLLSetLRETURN;-------------------------------------------------;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;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,FMOVLW06;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,FMOVLW03;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=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;C=LSB;1cyclGOTOPLLOutSHARP;2cycl;tCKR=RateofCLK=18+3(cycles)>5UPLLOutMcRLFPLLBYTE,F;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,FGOTOPLLOutL;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;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,FMOVFINDF,WMOVWFPSHDATHINCFFSR,FMOFINDF,WMOVWFPSHDATLRETURN;---------------------------------------------------------;MZP/MZP0-Move(W)/00toAddr=(FSR)Length=(M_CNT)MZP0CLRWMZPMOVWFINDFINCFFSR,FDECFSZM_CNT,FGOTOMZPRETURN;=================================;******StartofProgram******;----------------------------------------------------START;RAM20-RAM7F,RAMA0-RAMFF=00hCLRFFSRBSFFSR,5;FSR=20hMZP00_LSKIP_IF_NOTFSR,7BSFFSR,5;FSR=80h->FSR=A0hCLRFINDFINCFSZFSR,FGOTOMZP00_L;PowerOnSettings;InitializeA/DSELECT_BANK_1;!!Bank1!!!movlw0x05movwfADCON1;SelectRA0,RA1-AnalogInput,vref=RA3SELECTBANK0;!!Bank0!!!movlwB′10000001′movwfADCON0;SelectFosc/32,Channel0-RA0,A/D-OnInitializeUSARTSELECT_BANK1;!!Bank1!!!movlw0x01;SetBaudRatefor115.200KHZ=movwfSPBRG;=14745.6KHZ/(64*(SPBRG+1))bcfTXSTA,_SYNC;SetAsynchronoysModebcfTXSTA,_BRGH;SetLowSpeedBaudRateSELECT_BANK_0;!!Bank0!!!bsfRCSTA,_CREN;EnableRXbsfRCSTA,_SPEN;EnableSerialPortSELECT_BANK_1;!!Bank1!!!bsfTXSTA,_TXEN;bcfTRISC,_TX;SetRFfrequency8.014KHZandPresc.=4=T2CON,0=1RF!!!SELECT_BANK_1;!!Bank1!!!movlwRF_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!!BSFCTS_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!!!CALLPLLSetup;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,FCLRFFRFMOVLWSYNC5L;PrepareSendSYNC5*8bit(01010101)toTXMOVWFRFMCNT;5*SYNCBytesMOVLWSYNC01BMOVWFRF_BYTE;SYNCByte01010101MOVLW08MOVWFRFCNT;8BitsMOVLWTXTYPEMOVWFRFFSR;AddrBUFTX=A1hBSFFRF,_BUSY;ReadytoRFTXRETLW00MRFRX;RFTX=0ReceiveRFAllMessageNOP;USCLRFM8CNTINCFM8CNT,FCLRFFRFMOVLWRXTYPEMOVWFFSR;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)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=YesACK/0=NoBSFFCOMH,_LENMOVWFMTYPEMOVWFSCOMHRETLW00;MCOMH->MCOHM->MPWMS->MADSM->MCOMH..MCMHLENBSFFCOMH,_COMADDWFSCOMH,F;KSMOVWFMHCNTMOVLWACOMH0SKIPIFSETMTYPE,6GOTOMCMHLEN2;=0PC->HUBCOMH;=1PC-HUB-RF_TX->TOYCOMRFTXSKIP_IF_NOTMF,RFTXCLRFFRF;1RFTX->StopTXBCFMF,RFIX;alwaystoRFRXMOVLWRXTYPEMOVWFFSRMOVFMTYPE,WMOVWFINDFINCFFSR,FMOVFMHCNT,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;CNT=LengCOMM+1(KS)RETLW00;MCOMH-&gt;MCOHM-&gt;MPWMS-&gt;MADSM-&gt;MCOMH...MCMHCOMMOVFACOMH,WINCFACOMH,FMOVWFFSRMOVFMBYTE,WMOVWFINDFADDWFSCOMH,F;KSDECFSZMHCNT,FRETLW00;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=Year(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!!!SKIP_IF_NOTTXSTA,_TRMTGOTOMCHM;=1itispossibleSendHUB->PCSELECT_BANK_0;!!Bank0!!!NotDelete!!!RETLW03;USARTbusyMCOHM->MCOMH(MPWMS)...MCHM;Ptepare(PODGOTOBKA)HBYTEtoSendHUB->PCSELECT_BANK_0;!!Bank0!!!MotDelete!!!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=Year(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,FGOTOMCHMCOM2;ENDCOHMSENSOR(ACK)alreadySenttoPCSendKS,COHM=0,FCOHM=0BCFMF,COHMCLRFFCOHMMOVFSCOHM,WMOVWFTXREG;SendKStoPC,andthenRETLW00;MCOHM->MCOMH..MCHMCOW2;SendCurrent(TEK)ByteCOHMtoPCMOVFACOHM,WINCFACOHM,FMOVWFFSRMOVFINDF,WADDWFSCOHM,F;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!!!SELECT_BANK1;!!Bank1!!!movlwRFPR;(RF);14745.6/(4*8kHz)-1=115.2-1=114movwfPR2;!!Bank1!!!SELECT_BANK_0;!!Bank0!!!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,FINCFFSR,FDECFBARL,WMOVWFINDFMPWM;ReadPacketDataPC-UART->HUB->FIFO8KSKIP_IF_SETPIR1,_RCIFRETLW02;RCIF=0->NotUARTBytefromPC;USCALLIMPULS;TESTIMPULS|_|-BPEMEHHO;YesUARTBytefromPCtoHUB(->W)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,FINCFFSR,FDECFBAWL,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!!!movlwPWM_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,FMADSM2CALLBUF_WBCFMFH,_AD;SetA/DNotStartedFlagMAD;SendSamplesfromFIFOtoUSART->PCSKIP_IF_NOTCTS_TRIS,CTS_BIT;CTS=RC1RETLW04;CTS=1=>PCNotReadytoRead;CheckUSARTBusySELECT_BANK_1;!!Bank1!!!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;(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!!!;ProcessTimer2Int->TestandSetPWMTMR2_INTBCFPIR1,_TMR2IF;ClearIntFlagSKIP_IF_NOTT2CON,0;!!if1->Presc=4->Not56KHZGOTOTMR2_8KHZ;1->RF(NotPWM)->8KHZ(Not56KHZ)DECFSZPWM_Cntr,FGOTOIRET;PWM_Cntr#0movlwOVERSAMPLING;=7->8KHZ*7=56KHZmovwfPWM_Cntr;ResetPWMPulseCounterTMR2_8KHZINCFSZTMR_125U,F;125U=17.90364S84U*7=125.32552088UGOTOTMR_TTME;Time=(TMR_125U)*125.32S5UINCFSZTMR_32MS,F;32MS=125.32552088U*256=32.083333345MSGOTOTMR_TIME;Time=(TMR_3MS)*32.08333MSINCFTMR_8SEC,F;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;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,FGOTORF_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;ShiftbittoCorrelator;CompareCorrelatorSKIP_IF_EQULINDF,-SYNC01B;RFBitsInverse.Skipif==GOTORXNO;NotSync-ByteINCFRF_CNT,FGOTORF_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;C=xxxxxxxxX,X=NextBit,MSBFirstSKIPIFNEQULRF_BYTE,-BARKERB;SkipifNotBarkerGOTORX_BAR_OK;YesBarker,DetectesBarkerOKDECFSZRF_CNT,F;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;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,FBSFFRF,_NIB;NextLowNibbleGOTORF_CUR_END;PrepareRF_BYTE=FChRX_CUR_L;LowNibbleRXIORWFINDF,W;(W)=AllByteMOVWFINDFINCFRF_FSR,F;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;KSADDLW01;+1(BytewithKS)MOVWFRF_CNTGOTORF_CUR_END;PrepareRF_BYTE=FChRX_CUR_BDECFSZRF_CNT,FGOTORF_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;KS+=Cur.ByteRF_CUR_END;PrepareRF_BYTE=FChMOVLWOFCMOVWFRF_BYTEGOTORF_END;---------------------------------------------;---------RFDataTransmitting;RF_TXRLFRF_BYTE,F;SendNextBittoRF,MSBFirstSKIP_IF_CGOTORFTXOBSFTX_DAT_P,TX_DATA;RA2=1GOTOTX_DECRFTXOBCFTX_DATA_P,TX_DATA;RA2=0TX_DEC;DecrementBitCounterDECFSZRF_CNT,FGOTORF_ENDBSFRF_CNT,3;RF_CNT=8BitsRLFRF_BYTE,F;RF_BYTE=SYNC-Byteagain01010101SKIP_IF_NOTFRF,_CURGOTOMTX_CUR;1YesBARker,TransmitsCurrenthalf-BytesDECFSZRFMCNT,F;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;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;RF_CNT=7Bits(=8-1)DECFSZTX_CNT,F;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=FEhGOTOTST_FETST_NOFFMOVFMM1PW,WTST_FESKIP_IF_SETMFH,TSMPLGOTOIRET;0SampleNotchangedBCFMFH,TSMPL;1Samplerenewed(O6HOBILOC6)(=0)INCFMM11PW,FSKIP_IF_WNEQUSample;Skipif(W)#SampleGOTOIRET;W=Sample->OKNOP;US;MM11PW#Sample->TestErrorDECFMM11PW,F;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>=YmovfY,WsubwfX,W;W=X-Y/*ifwasbarrowCarry=0*/btfssSTATUS,_C;SkipifX>=Y(C=1)ENDMSKIP_IF_LESSMACROX,Y;SkipifX<YmovfY,W;W=YsubwfX,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,FSKIP_IF_ZGOTOS+3;(X)#00hMOVFX+1,F;(X)=00hSKIP_IF_Z;Skipif(X)=(X+1)=00hENDMSKIP_IFM_NZMACROX;Skipif(X)#00h.or.(X+1)#00hMOVFX,FSKIP_IF_ZGOTOS+4;(X)#00h=>SkipMOVFX+1,F;(X)=00hSKIP_IF_Z;Skipif(X)#00h.or.(X+1)#00hENDMINCMMACROX;X=(XH,XL)=X++(+=1)INCFSZX+1,FGOTOS+2INCFX,F;X=(XH,XL)=X++(+=1)ENDMDECMMACROX;X=(XH,XL)=X--(-=1)MOVFX+1,FSKIP_IF_NZDECFX,F;(XL)=(X+1)=0->(XH)--(-=1)DECFX+1,FENDMINT_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,FWGOTOB_R;li;0i=>BUFemptyorfullBTFSSBF,FRGOTOBRWE;00=>BUFempty;01=>BUFfull->read,andthenBF,WR=BF&lt;10&gt;=11BSFBF,FW;readbytefromBUFferB_RB_ININCFSZBARL,FGOTOB_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,FWB_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,FR;BCM=16+1->BF,WR=10(before11)GOTOBRW_OK;;---------------------------------------------------;****BUF_W-writeBYTEfromWinBUFfer;exitC=0-OK,C=1-notwrite(BUFfull);---------------------------------------------------BUF_WMOVWFBYTE;save(W)=bytesourceBTFSCBF,FWGOTOB_W;1i;0i=>BUFemptyorfullBTFSCBF,FRGOTOBRWE;01=>BUFfull;00=>BUFempty->write,andthenBF,WR=10BSFBF,FW;writeBYTEinBUFferB_WB_OUTINCFSZBAWL,FGOTOB_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,FWGOTOBRW_OKB_W4MOVFBCM,FSKIP_IF_ZGOTOBRW_OK;BCH=0->BCM<256MOVFBCM+1,WSUBLWBC_restSKIP_IF_ZGOTOBRW_OK;BCM=16->BF,WR=11(before10)BSFBF,FR;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,FLAGS_BYTE,MAIN_2jsrwait_rf_mssg_2;gettherfmessagebrclrsync_det_flag,flags_byte,main_1_1;msgfail?BCLRSYNC_DET,FLAGS_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,FLAGS1_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,FLAGS_BYTE;WILLBESETWHENSYNCDETECTEDCLRSYNC_COUNTERBSETFIND_SYNC_FTAG,FLAGS_BYTE;FINDSYNCMODEBCLRFIND_BIT_FLAG,FLAGS_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,FLAGS_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,FLAGS_BYTEW_NO_CARR_EXRTS;*******************************************************************WAIT_TO_CARR;WAITTILLCARRIER,THENOK_FLAG=1;USESACC,XBSETOK_FLAG,FLAGS_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,FLAGS_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,FLAGS_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,FLAGS1_BYTE,WAIT_RF_MSSG_3BRAW_RF_MSSG_FAILWAIT_RF_MSSG_3JSRDETECT_STRBRCLRBYTE_DTCTED_FLAG,FLAGS1_BYTE,W_RF_MSSG_FAILNOP;jsrtest_comoare;BLINKLEDIFOKBRAW_RF_MSSG_EXITW_RF_MSSG_FAILBCLRSYNC_DET_FLAG,FLAGS_BYTEW_RF_MSSG_EXITRTS;****************************************************************REC_HEADER;afterdetectingthesync,needtowaitfor1byteofheader.;firstwaitforthefirstbitBSETFIND_BIT_FLAG,FLAGS_BYTE;THETIMERWILLDETECTBITSCLRTXRX_BYTEclrheader_bit_cntrLDX#!10;10*5.3ms=53mstosearchLDA#!255;5.3msSTAREG2REC_HEADER_LBRSETBIT_DTCTED_FLAG,FLAGS1_BYTE,REC_HEADER_BIT;5CYCBRSETBIT_DET_FAIL_FAIL_FL,FLAGS1_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,FLAGS1_BYTEBCLRBIT_DET_FAIL_FL,FLAGS1_BYTEBRAREC_HEADER_LREC_HEADER_BIT;bitdetectedok,sorotatethetxrx_byteuntildetectstheheaderbyte.BCLRBIT_DTCTED_FLAG,FLAGS1_BYTEBCLRBIT_DET_FAIL_FL,FLAGS1_BYTEBRSETBIT_DETECTED_BIT,FLAGS1_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,FLAGS1_BYTE,mic_closedjsrListenClosemic_closedLDATXRX_BYTECMP#UNIT_CODE_NOMBERbeqok_Continuecmp#BROADCAST;CheckBroadcastBNEREC_HEADER_Lok_ContinuestaTXRX_REC_BUFF;StoreReceivedByteBSETREC_HEADER_FLAG,FLAGS1_BYTEBRAREC_HEADER_EXITREC_HEADER_FAILBCLRREC_HEADER_FLAG,FLAGS1_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,FLAGS1_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,FLAGS_BYTE;THETIMERWILLSTOPDETECTBITSRTS;****************************************************************DETECT_BYTE;detect8bitsfromthereceiver.;saveresultinTXRX_BYTEBCLRBYTE_DECTED_FLAG,FLAGS1_BYTECLRTXRX_BYTELDA#!8STARFG3;COUNTERLDA#!5;4*5.3ms=21mstosearchSTAREG1LDA#!255;5.3msSTAREG2DETECT_BYTE_LBRSETBIT_DTCTED_FLAG,FLAGS1_BYTE,DETECT_BYTE_BIT;SCYCBRSETBIT_DET_FAIL_FL,FLAGS1_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,FLAGS1_BYTEBCLRBIT_DET_FAIL_FL,FLAGS1_BYTEBRSETBIT_DETECTED_BIT,FLAGS1_BYTE,DETECT_BYTE_BIT1CLCBRADETECT_BYTE_BIT2DETECT_BYTE_BF;thefirsttimetocheckabytewegetfail(becauseofthespacebetweenone;bytetotheother.soifthefailappearsatbit#0wecontinuetocheck.BCLRBIT_DET_FAIL_FL,FLAGS1_BYTE;INITLDAREG3CMP#!8BEQDRYECT_BYTE_LBRADETECT_BYTE_FAIL;NOTTHEFIRSTBITSOFAILDETECT_BYTE_BIT1SECDETECT_BYTE_BIT2ROLTXRX_BYTEDECREG3BNEDETECT_BYTE_LBSETBYTE_DTCTED_FLAG,FLAGS1_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,FLAGS_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,FLAGS_BYTE,TIMER_SYNC_BITBRCLRFIND_SYNC_FLAG,FLAGS_BYTE,TIMER_SYNC_EXITJSRCHECK_TIME;CHECKIF400<t<600usBRCLRIF_FLAG,FLAGS_BYTE,TIMER_SYNC_FAILINCSYNC_COUNTERLDASYNC_COUNTERCMP#!10BNETIMER_SYNC_EXIT;BCSBSETSYNC_DET_FLAG,FLAGS_BYTEBSETFIND_SYNC_FLAG,FLAGS_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,FLAGS1_BYTE;initBCLRBIT_DET_FAIL_FL,FLAGS1_BYTE;initBCLRBIT_DETECTED_BIT,FLAGS1_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,FLAGS_BYTE,BIT_TIMER_1BSETBIT_DTCTED_FLAG,FLAGS1_BYTE;initBCLRBIT_DETECTED_BIT,FLAGS1_BYTE;statusofthedetectedbitBRABIT_TIMER_EXITBIT_TIMER_1JSRIF_ONE_TIMEBRCLRIF_FLAG,FLAGS_BYTE,BIT_TIMER_FAILBSETBIT_DTCTED_FLAG,FLAGS1_BYTE;initBSETBIT_DETECTED_BIT,FLAGS1_BYTE;statusofthedetectedbitBRABIT_TIMER_EXITBIT_TIMER_FAILBSETBIT_DET_FAIL_FL,FLAGS1_BYTE;initBIT_TIMER_EXITRTS;*******************************************************************CHECK_TIME;wewillcheck600us(275=113h)(THEACTUALTIMEIS525US/2=106H);and400us(200=0c8h)BSETIF_FLAG,FLAGS_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,FLAGS_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,FLAGS_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,FLAGS_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,FLAGS_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,FLAGS_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,FLAGS1_BYTErts;---------------------------------------------------------;ProcListenCloseSetTx-Mute;InputNo;OutputNo;SpoildRegsA,X,Tmp1;---------------------------------------------------------ListenCloselda#04hjsrOutPLLAddrldaPll4Loora#%00000100;SetTx-MutestaPll4Lotax;LoadLotoXldaPll4Hi;LoadHitoAjsrOutPLLDataJSRTRANSMITTER_OFFbclrTOIE,TCR;EnableTimerCounterbclrMIC_OPEN_FLAG,FLAGS1_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!=NULL)  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!=STATUS_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!=STATUS_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,FALSE,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,FAISE,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!=NULL){  SetEvent(hAsync);  CloseHandle(hUnitTalkThread);  hUnitTalkThread=NULL;  }returnret_value;}//======================================CREAPI_STATUScrUnitTalk(WORDwUnitNumber,DWORDdwFlags,LPCTSTRpszSource,HANDLEhOpAsync){  DWORDdwThreadID;  DWORDstatus;  if(hUnitTalkThread!=NULL&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!=STATUS_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,FILE_CURRENT)-WAVE_HEADER_LENGTH;SetFilePointer(hRecordFile,WAVE_DATA_LEN_POS,NULL,FILE_BEGIN);  WriteFile(hRecordFile,&amp;amp;data_size,sizeof(data_size),&amp;amp;written,NULL);  }  CloseHandle(hRecordFile);  hRecordFile=INVALID_HANDLE_VALUE;  if(hRecordAsync!=NULL){  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!=INVALID_HANDLE_VALUE&amp;amp;&amp;amp;lpszDest==NULL){  SetEvent(hUnitRecordBreak);  WaitForSingleObject(hUnitRecordThread,INFINITE);  returnSTATUS_OK;  }  hRecordFile=CreateFile(lpszDest,GENERIC_WRITE,0,NULL,CREATE_ALWAYS,FILE_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!=WAVE_HEADER_LENGTH){  CloseHandle(hRecotdFile);  hRecordFile=INVALID_HANDLE_VALUE;  returnCREAPI_STATUS_ERR_FILE_WRITE;  }  }  hRecordAsync=hOpAsync;  dwTime=dwTime_ms;  ResetEvent(hUnitRecordBreak);  if(hOpAsync!=NULL)  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!=WAVE_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!=ASRERROK){  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!=ASRERR_OK)  returnstatus+SR_MIN_ERR_VALUE;  status=asrRecStart(hAsr,NULL,NULL);  if(status!=ASRERR_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!=ASRERR_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!=ASRERR_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)!=0||mode!=wCtxMode)(  if(wCtxMode!=CTX_CLOSE){  if(wCtxMode==CTX_READ_MODE){  status=asrRecCtxActivateEx(hAsr,(ASRACTIVATE*)NULL,0,(HLIB)NULL);  if(status!=ASRERR_OK)  returnstatus+SR_MIN_ERR_VALUE;  }  status=asrCtxClose(hCtx,TRUE);  if(status!=ASRERR_OK)  returnstatus+SR_MIN_ERR_VaLUE;  }  if(mode!=CTX_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!=ASRERR_OK){  asrCtxClose(hCtx,FALSE);  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!=ASRERR_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!=ASRERR_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!=ASRERR_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!=ASRERR_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!=STATUS_OK){  GlobalFree(pWord);  GlobalFree(pSource);  GlobalFree(pWordsInDB);  SetActiveContext(active_context,CTX_READ_MODE);  returnstatus;  }  status=asrCtxAddWord(hCtx,(HDICT)NULL,″Word″,pWord);  if(status!=ASRERR_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!=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!=STATUS_OK){  GlobalFree(pWord);  GlobalFree(pSource);  GlobalFree(pWordsInDB);  SetActiveContext(active_context,CTX_READ_MODE);  returnstatus;  }  status=asrCtxDeleteWord(hCtx,″Word″,pWord);  if(status!=ASRERR_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!=ASRERR_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!=ASRERR_OK)  returnstatus+SR_MIN_ERR_VALUE;  returnSTATUS_OK;}//========================================================voidWaitForEventBufferReady(PNOTIFY_PARAMSpNotifyParams){  ASRERRORstatus;  status=asrRecAcqWaveBuffer(hAsr,pNotifyParams->pBuffer,pNotifyParams->dwBufferLength);  if(status!=0)  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!=ASRERR_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!=ASRERR_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!=STATUS_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!=ASRERR_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!=NULL){  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!=R_SUCCESSFUL){  status=TtsUninitialize(hTTSInst);  returnstatus+TTS_MIN_ERR_VALUE;  }  status=TtsSetFreq(hTTSInst,M_FREQ_8KHZ);  if(status!=R_SUCCESSFUL){  status=TtsUninitialize(hTTSInst);  returnstatus+TTS_MIN_ERR_VALUE;  }  returnSTATUS_OK;}DWORDttsClose(){  intstatus;  status=TtsUninitialize(hTTSInst);  if(status!=R_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!=R_SUCCESSFUL)  returnstatus+TTS_MIN_ERR_VALUE;  returnSTATUS_OK;}CREAPI_STATUScrTsSetSpeechMode(PTTS_SPEECH_MODEpSpeechMode){  intstatus;  status=TtsSetSpeechMode(hTTSInst,FALSE,  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软件协议实现模块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!=STATUS_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!=NULL){  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!=MARKER_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!=NULL){  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!=pLastByte&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!=0){  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,FILE_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!=0){  pHeader->overlapped.hEvent=CreateEvent(NULL,FALSE,FALSE,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,FALSE,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,FILL_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,Forms,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,Forms,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,Forms,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,Forms,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>玩具构成源代码<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,Forms,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,Flags);  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本领域的熟练技术人员可以理解本发明并不限于以上具体示出和描述的。本发明的范围仅由以下的权利要求限定。权利要求1.一种交互式玩具设备,包括具有有趣的物理外观的玩具;安装在该玩具上的扬声器;用户输入接收器;存储有关至少一用户的信息的用户信息存储单元;和内容控制器,其响应于经该用户输入接收器接收的当前用户输入和该存储单元中存储的信息进行工作,经该扬声器提供音频内容给该用户。2.根据权利要求1的交互式玩具设备,其中该用户输入接收器包括一音频接收器。3.根据权利要求2的交互式玩具设备,其中该当前用户输入包括经该音频接收器接收的一言语输入。4.根据权利要求1的交互式玩具设备,其中该用户输入接收器包括一触觉输入接收器。5.根据权利要求1的交互式玩具设备,其中该存储单元存储有关至少一用户的个人信息且该内容控制器进行工作以使该音频内容人性化。6.根据权利要求1的交互式玩具设备,其中该存储单元存储有关至少一用户与该交互式玩具设备的交互的信息且该内容控制器进行工作以根据存储的有关该至少一用户与该交互式玩具设备的过去的交互的信息来控制该音频内容。7.根据权利要求5的交互式玩具设备,其中该存储单元还存储有关至少一用户与该交互式玩具设备的交互的信息且该内容控制器还进行工作以根据有关该至少一用户与该交互式玩具设备的过去的交互的信息来控制该音频内容。8.根据权利要求1的交互式玩具设备,其中该存储单元还存储由一用户经该用户输入接收器言语地输入的信息。9.根据权利要求5的交互式玩具设备,其中该存储单元还存储由一用户经该用户输入接收器言语地输入的信息。10.根据权利要求7的交互式玩具设备,其中该存储单元还存储由一用户经该用户输入接收器言语地输入的信息。11.根据权利要求1的交互式玩具设备,还包括一内容存储单元,存储经该扬声器待被播送给一用户的至少一内容标题的的音频内容,该至少一内容标题是交互式的且包含交互分支。12.根据权利要求11的交互式玩具设备,其中该至少一内容标题包括存储对应的多个内容标题部分的多个音频文件,包括至少两个可替换的内容标题部分;和响应于一任意的一用户输入、一环境条件、一过去的交互、有关一用户的个人信息、一远程计算机、和一与时间有关的条件在这些可替换的用户部分之间的一文本定义分支。13.根据权利要求5的交互式玩具设备,还包括一内容存储单元,存储经该扬声器待被播送给一用户的至少一内容标题的的音频内容,该至少一内容标题是交互式的且包含交互分支。14.根据权利要求13的交互式玩具设备,其中该至少一内容标题包括多个内容元素的并行部分,该多个内容元素的并行部分包括至少两个可替换的部分,和在这些可替换的部分之间的以一人性化方式的一文本定义分支。15.根据权利要求1的交互式玩具设备,其中该用户信息存储单元被至少部分地定位在该玩具中。16.根据权利要求1的交互式玩具设备,其中该用户信息存储单元被至少部分地定位在该玩具外。17.根据权利要求1的交互式玩具设备,其中该内容存储单元被至少部分地定位在该玩具中。18.根据权利要求1的交互式玩具设备,其中该内容存储单元被至少部分地定位在该玩具外。19.根据权利要求1的交互式玩具设备,其中该用户输入接收器包括安装在该玩具上的一麦克风;和接收自该麦克风输入的一语句的一语音识别单元。20.根据权利要求5的交互式玩具设备,其中该用户信息存储单元进行工作以存储有关各可用一唯一码识别的多个用户的个人信息且其中该内容控制器进行工作以提醒任意用户提供该用户码。21.根据权利要求5的交互式玩具设备,其中该用户信息存储单元进行工作以存储有关一用户的合作行为的信息。22.具有改变脸部表情的玩具设备,该玩具包括多特征化的脸部设备,包括多个可多位置的脸部特征;和一脸部表情控制单元,其进行工作以至少生成代表至少两个对应的脸部表情的多个脸部特征的位置的三种组合。23.根据权利要求22的设备,其中该脸部表情控制单元进行工作以使这些特征以不同的速率在多个位置之间变动,从而生成不同情绪的错觉。24.根据权利要求22的设备,还包括一扬声器装置;存储一音频声明的一音频存储器;和进行工作以通过该扬声器装置控制该音频声明的输出的一音频输出单元,且其中该脸部表情控制单元进行工作以与该声明的输出同步地生成多个位置的组合。25.用于播放一交互式言语游戏的玩具设备,包括一玩具;安装在该玩具上的一扬声器装置;安装在该玩具上的一麦克风;接收自该麦克风输入的一语句的一语音识别单元;和一音频存储单元,用于存储通过该扬声器装置待被播放的多个言语游戏段;和在这些言语游戏段之间的一文本存储定义交互分支。26.根据权利要求25的玩具设备,其中这些言语游戏段包括提醒一用户生成对该言语游戏的一说出的输入的至少一段。27.根据权利要求25的玩具设备,其中该至少一段包括两或更多的言语串和一对该用户的提醒以再现这些言语串之一。28.根据权利要求25的玩具设备,其中该至少一段包括一谜。29.根据权利要求25的玩具设备,其中这些言语串中的至少一个具有教育内容。30.根据权利要求25的玩具设备,其中这些言语串中的至少一个包括有关在该游戏中的该用户的行为的性质对用户的一个反馈。31.根据权利要求1的交互式玩具设备,还包括与该玩具一起装配的包括多个可多位置的脸部特征的多特征化脸部设备;和一脸部表情控制单元,其进行工作以至少生成代表至少两个对应的脸部表情的多个脸部特征的位置的三种组合。32.根据权利要求31的交互式玩具设备,其中该脸部表情控制单元进行工作以使这些特征以不同的速率在多个位置之间变动,从而生成不同情绪的错觉。33.根据权利要求31的交互式玩具设备,还包括存储一音频声明的一音频存储器;和进行工作以通过该扬声器装置控制该音频声明的输出的一音频输出单元,且其中该脸部表情控制单元进行工作以与该声明的输出同步地生成多个位置的组合。34.根据权利要求1的交互式玩具设备,还包括安装在该玩具上的一麦克风;接收自该麦克风输入的一语句的一语音识别单元;和一音频存储单元,用于存储通过该扬声器装置待被播放的一言语游戏的多个言语游戏段;和在这些言语游戏段之间的一文本存储定义交互分支。35.根据权利要求34的交互式玩具设备,其中这些言语游戏段包括提醒一用户生成对该言语游戏的一说出的输入的至少一段。36.根据权利要求34的交互式玩具设备,其中该至少一段包括两或更多的言语串和一对该用户的提醒以再现这些言语串之一。37.根据权利要求34的交互式玩具设备,其中该至少一段包括一谜。38.根据权利要求34的交互式玩具设备,其中这些言语串中的至少一个具有教育内容。39.根据权利要求34的交互式玩具设备,其中这些言语串中的至少一个包括有关在该游戏中的该用户的行为的性质对用户的一个反馈。40.一种玩具交互的方法,包括提供具有有趣的物理外观的一玩具;提供安装在该玩具上的一扬声器;提供一用户输入接收器;将有关至少一用户的信息存储进一用户信息存储单元;经一响应于经该用户输入接收器接收的当前用户输入和该存储单元中存储的信息进行工作的内容控制器,经该扬声器提供音频内容给该用户。41.根据权利要求40的方法,其中该存储步骤包括存储有关至少一用户的个人信息并经该内容控制器使该音频内容人性化。42.根据权利要求40的方法,其中该存储步骤包括存储有关至少一用户与该交互式玩具设备的交互的信息且根据存储的有关该至少一用户与该交互式玩具设备的过去的交互的信息经该内容控制器来控制该音频内容。43.根据权利要求40的方法,还包括在一内容存储单元中存储经该扬声器待被播送给一用户的至少一内容标题的的音频内容,该至少一内容标题是交互式的且包含交互分支。44.根据权利要求40的方法,还包括存储有关各可用一唯一码识别的多个用户的个人信息且经该内容控制器提醒任意用户提供该用户码。45.根据权利要求40的方法,还包括存储有关一用户的合作行为的信息。46.根据权利要求40的方法,还包括提供多特征化的脸部设备,该多特征化的脸部设备包括多个可多位置的脸部特征;及至少生成代表至少两个对应的脸部表情的多个脸部特征的位置的三种组合。47.根据权利要求46的方法,还包括使这些特征以不同的速率在多个位置之间变动,从而生成不同情绪的错觉。48.根据权利要求46的方法,还包括存储一音频声明;及通过该扬声器提供该音频声明;且与该声明的输出同步地生成多个脸部位置的组合。49.一种用于使用交互式对象,将编程教授给学生的系统,该系统包括一计算机化的学生界面,允许一学生通过定义该交互式对象的特性赋与该交互式对象以生命,该计算机化学生界面进行工作以响应于学生输入至少部分地定义该交互式对象与人之间的交互;和一计算机化教师界面,允许一教师在定义该交互式对象的特性中监视学生的进度。50.根据权利要求49的系统,其中该计算机化教师界面允许该教师配置该计算机化学生界面。51.一种用于将交互式对象的设计和编程教授给学生的教授系统,该系统包括一计算机化的学生界面,允许一学生通过定义该交互式对象的特性赋与该交互式对象以生命,该计算机化学生界面进行工作以响应于学生输入至少部分地定义该交互式对象与人之间的交互;和一计算机化教师界面,允许一教师配置该计算机化学生界面。52.一种用于开发情绪上有知觉的计算机化的创造物的计算机系统,包括一计算机化的用户界面,允许一用户通过定义一情绪上有知觉的计算机化的创造物与自然人之间的交互来开发该情绪上有知觉的计算机化的创造物,该交互至少包括该情绪上有知觉的计算机化的创造物对从该自然人提供的一刺激所导出的,指示自然人情绪的至少一参数的至少一响应;和一创造物控制单元,其进行工作以根据由该用户定义的这些特性和交互来控制该情绪上有知觉的创造物。53.根据权利要求52的系统,其中该指示自然人情绪的参数包括除其语言内容之外的自然人语句的特性。54.一种用于开发情绪上有知觉的计算机化的创造物的方法,该方法包括过定义该情绪上有知觉的计算机化的创造物与自然人之间的交互,该交互至少包括该情绪上有知觉的计算机化的创造物对从该自然人提供的一刺激所导出的,指示自然人情绪的至少一参数的至少一响应;和根据由该用户定义的这些特性和交互来控制该情绪上有知觉的创造物。55.一种用于将编程教授给学生的方法,该方法包括提供一基于计算机化的虚拟编程的学生界面,允许学生执行虚拟编程;并提供一计算机化的教师界面,允许教师使配置该计算机化的学生界面。56.一种计算机化的情绪上有知觉的计算机化的创造物,包括多个交互模式,用于实现对应的多个与自然人的交互,该多个交互至少包括对指示自然人情绪的至少一自然人情绪参数的一响应;和一情绪感知单元,用于从由该自然人提供的一刺激导出至少一自然人情绪参数,并将该参数提供给多个交互模式中的至少一个。57.根据权利要求56的创造物,还包括一真实的个体,用于参与多个交互模式中的至少一个。全文摘要一种交互式玩具设备,包括:具有有趣的物理外观(17、18、19、20)的玩具(10),安装在玩具(10)上的扬声器(58),用户输入接收器(28),存贮有关至少一个用户的信息的用户信息存贮单元(74),响应通过用户输入接收器(28)接收的当前用户输入以及存贮在存贮单元(74)中的信息以便通过该扬声器向该用户提供音频内容的内容控制器(82)。文档编号G10L25/63GK1272800SQ99800961公开日2000年11月8日申请日期1999年4月15日优先权日1998年4月16日发明者奥兹·加拜,雅各布·加拜,尼姆罗德·桑德勒曼申请人:创造者有限公司
网友询问留言 已有0条留言
  • 还没有人留言评论。精彩留言会获得点赞!
1