原帖由 Serw 于 2007-7-17 13:23:00 发表 问题是上文还有你的AVG32脚本解析工具都只能得到指令, 看不到操作数的格式. 比如 $1C Jump 无条件跳转, 最后会跳转到什么地方? $37 Var Bit变量赋值 是给哪个变量赋什么值?
|
快速的回顾了一下我的解析器的源码,每一个指令的参数在解析器内部好像都分析出来了的。
我记得当时是因为没有工夫去写详细的界面,于是没有把所有的信息都显示出来(但是解析器二进制窗口中你点每条指令就会把对应的参数源码显示出来,这样很方便用眼睛瞄得:D)
鉴于楼上应该已经能够解包SEEN了,我这里只把对解开后的每个脚本的解析代码列出来:
- // Copyright 2001-2004 Misha @ Keyfc.net
- // 仅供个人研究学习,严禁他用
- // 未经作者许可,请勿转载
- Unit SCENUnpack;
- Interface
- Uses SysUtils, ComCtrls, Contnrs, MD5Service;
- Const
- ScenFileSignature: String = 'TPC32';
- ResourceString
- SeenScriptSignError = '脚本签名错误';
- SeenHeaderMenuCountError = '脚本菜单数量错误 (%d)';
- SeenHeaderSubMenuCountError = '脚本子菜单数量错误 (%d:%d)';
- SeenHeaderSubMenuMaxError = '脚本子菜单最值错误 (%d-%d:%d)';
- SeenHeaderSubMenuLoopError = '脚本循环子菜单标记数量错误 (%d-%d-%d:%d)';
- SeenHeaderGetTextError = '错误的行号';
- SeenCMDTextExtractNIL = '无效文字提取过程';
- SeenCMDNIL = '空指令序列';
- SeenCMDSelectListError = '选项列表没有开始';
- SeenCMDSumError = '不能识别的求和指令';
- SeenCMDValueHeaderError = '无效数值头';
- SeenCMDConditionLevelOverflow = '太多的条件嵌套';
- SeenCMDConditionLOperPosError = '无效的逻辑指令位置';
- SeenCMDConditionPropertyUnExp = '意外的属性指令';
- SeenCMDConditionPropertyPosError = '无效的属性指令位置';
- SeenCMDConditionPropertyError = '无效的属性指令参数';
- SeenCMDConditionError = '无效的条件指令';
- SeenCMDFStringConditionError = '同一分支出现多个条件';
- SeenCMDFString10hSubCMDError = '无效的字符串格式 ($10子指令)';
- SeenCMDFStringError = '无效的字符串格式';
- SeenCMDExplainDetailUnImp = '$%.2x:$%.2x 的详细资料 (不可用功能)';
- SeenCMDFaultHeader = '出错命令:';
- SeenCMDExpEmpty = '空指令记录';
- SeenCMDExpCat01 = '全部脚本结束';
- SeenCMDExpCat02 = '等待鼠标点击, 然后换行或者清除文字';
- SeenCMDExpCat03 = '换行 {...}';
- SeenCMDExpCat04 = '等待点击, 然后继续脚本';
- SeenCMDExpCat05 = '文本窗口操作 {...}';
- SeenCMDExpCat06 = '特效文本 {...}';
- SeenCMDExpCat07 = '图像/PDT文件操作 {...}';
- SeenCMDExpCat08 = '动画操作 {...}';
- SeenCMDExpCat09 = '声音/媒体操作 {...}';
- SeenCMDExpCat10 = '变量文字写入 {...}';
- SeenCMDExpCat11 = '图像渐变操作 {...}';
- SeenCMDExpCat12 = '条件转移';
- SeenCMDExpCat13 = '指令转移 {...}';
- SeenCMDExpCat14 = '图像摇动 {...}';
- SeenCMDExpCat15 = '文字颜色';
- SeenCMDExpCat16 = '等待 {...}';
- SeenCMDExpCat17 = '脚本内嵌入';
- SeenCMDExpCat18 = '无条件跳转';
- SeenCMDExpCat19 = '查询表格条件嵌入';
- SeenCMDExpCat20 = '查询表格条件跳转';
- SeenCMDExpCat21 = '嵌入返回';
- SeenCMDExpCat22 = 'Bit变量赋值';
- SeenCMDExpCat23 = 'Bit变量复制';
- SeenCMDExpCat24 = '整数变量赋值';
- SeenCMDExpCat25 = '整数变量 +';
- SeenCMDExpCat26 = '整数变量 -';
- SeenCMDExpCat27 = '整数变量 *';
- SeenCMDExpCat28 = '整数变量 /';
- SeenCMDExpCat29 = '整数变量 %';
- SeenCMDExpCat30 = '整数变量 AND';
- SeenCMDExpCat31 = '整数变量 OR';
- SeenCMDExpCat32 = '整数变量 XOR';
- SeenCMDExpCat33 = '整数变量复制';
- SeenCMDExpCat34 = '整数变量 + 整数变量';
- SeenCMDExpCat35 = '整数变量 - 整数变量';
- SeenCMDExpCat36 = '整数变量 * 整数变量';
- SeenCMDExpCat37 = '整数变量 / 整数变量';
- SeenCMDExpCat38 = '整数变量 % 整数变量';
- SeenCMDExpCat39 = '整数变量 AND 整数变量';
- SeenCMDExpCat40 = '整数变量 OR 整数变量';
- SeenCMDExpCat41 = '整数变量 XOR 整数变量';
- SeenCMDExpCat42 = 'Bit变量随机赋值';
- SeenCMDExpCat43 = '整数变量随机赋值';
- SeenCMDExpCat44 = '用户选择操作 {...}';
- SeenCMDExpCat45 = '字符串操作 {...}';
- SeenCMDExpCat46 = '多变量赋值 {...}';
- SeenCMDExpCat47 = '多变量初始化 {...}';
- SeenCMDExpCat48 = '多变量顺序复制 {...}';
- SeenCMDExpCat49 = '获得脚本信息 {...}';
- SeenCMDExpCat50 = '多变量统计操作 {...}';
- SeenCMDExpCat51 = '系统杂项操作 {...}';
- SeenCMDExpCat52 = '名称操作 {...}';
- SeenCMDExpCat53 = '图像Get/Put操作 {...}';
- SeenCMDExpCat54 = '图像处理 {...}';
- SeenCMDExpCat55 = '写字符串到图像缓存';
- SeenCMDExpCat56 = '图像缓存操作 {...}';
- SeenCMDExpCat57 = '图像画面操作 {...}';
- SeenCMDExpCat58 = '图像滚动切换';
- SeenCMDExpCat59 = '多图像滚动处理 {...}';
- SeenCMDExpCat60 = '区域信息操作 {...}';
- SeenCMDExpCat61 = '鼠标操作 {...}';
- SeenCMDExpCat62 = 'CG模式操作 {...}';
- SeenCMDExpCat63 = '系统窗口状态操作 {...}';
- SeenCMDExpCat64 = '系统窗口位置操作 {...}';
- SeenCMDExpCat65 = '系统状态操作 {...}';
- SeenCMDExpCat66 = '弹出菜单控制 {...}';
- SeenCMDExpCat67 = '音量控制 {...}';
- SeenCMDExpCat68 = 'Novel模式控制 {...}';
- SeenCMDExpCat69 = '显示半角文字';
- SeenCMDExpCat70 = '显示全角文字';
- SeenCMDExpCatXX = '未知命令 $%.2x:$%.2x';
- Type
- RMixInt = Record
- Case Boolean of
- True: ( Bytes: Array[0..3] of Char );
- False: ( AInt: Integer );
- END;
- RScenHeader = Record
- Sign: Array [1..16] of Char;
- Resv: Array [1..8] of Char;
- LineCount: Integer;
- END;
- RScenMenu = Record
- Start, LoopBack: Integer;
- Num: Byte;
- SubNum, ID, StrID: Array[1..8] of Byte;
- SubCnt, SubCntMax, SubID, SubStrID: Array[1..8, 1..8] of Byte;
- Flag: Array[1..8, 1..8, 1..8] of Byte;
- SubStart: Array[1..8, 1..8, 1..8] of Integer;
- Str: Array[0..71] of ANSIString;
- Cur, CurSub, CurSubSub: Integer;
- Bit, BitCnt, SubBit, SubBitCnt: Byte;
- END;
- RLine = Record
- Index: Integer;
- Text: ANSIString;
- END;
- RValue = Record
- IsRegister: Boolean;
- Spacing: Byte;
- Value: Integer;
- END;
- RText = Record
- IsRegister: Boolean;
- IsIndirect: Boolean;
- Value: Integer;
- Spacing: Integer;
- Text: ANSIString;
- END;
- SCondType = ( CPRInt, CPRBit, CPImm, CPAttr, CPLOp );
- RCondRec = Record
- CType: SCondType;
- CValue: Integer;
- END;
- RConR = Array of RCondRec;
- RCond = Record
- Spacing: Integer;
- Condition: RConR;
- END;
- RSelect = Record
- Text: ANSIString;
- Condition: RConR;
- END;
- PPutLineProc = Procedure(Index: Integer; Text: ANSIString) of Object;
- RScenCMD = Class
- Private
- Offset: Integer;
- Source: ANSIString;
- CMD, SCMD, SSCMD: Byte;
- CMDIntR: Array[1..32] of RValue;
- CMDStrR: Array[1..4] of RText;
- CMDStr: Array[1..2] of ANSIString;
- CMDInt: Array[1..16] of Integer;
- CMDAInt: Array of Integer;
- CMDAByte: Array of Byte;
- CMDAStr: Array of ANSIString;
- CMDAIntR: Array of RValue;
- CMDAIntDR: Array of Array of RValue;
- CMDAStrR: Array of RText;
- CMDACond: Array of RCond;
- CMDASelR: Array of RSelect;
- Function IntReader(Pos: Integer): Integer;
- Function ValueReader(Pos: Integer): RValue;
- Function TextReader(Pos: Integer): RText;
- Function Conditioner(Pos: Integer; ExpectAttr: Boolean = False): RCond;
- Function ReadFString(Pos: Integer; ExpectAttr: Boolean = False): Integer;
- Function Han2Zen(StrIn: ANSIString): ANSIString;
- Procedure Fault(Error: String; Pos: Integer = 256);
- Public
- Constructor Create(OrigLen, LineMax: Integer; PutLine:PPutLineProc; Var CMDString: ANSIString);
- Destructor Destroy; Override;
- Function Explain(Detail: Boolean): String;
- Procedure ExpressTree(Tree: TTreeView; Root: TTreeNode);
- Property RAWText: ANSIString read Source;
- Property Start: Integer read Offset;
- END;
- RCMDTerm = Class
- Private
- ErrorMSG: String;
- Public
- Constructor Create(LError: String);
- Destructor Destroy; Override;
- Property Error: String read ErrorMSG;
- END;
- TScenario = Class
- Private
- SourceLen: Integer;
- SourceMD5: String;
- Source: ANSIString;
- Header: RScenHeader;
- IndexedLines: Array of RLine;
- MenuPad: Integer;
- Version: Integer;
- ExtraPad: Integer;
- Counter: Integer;
- JumpBase: Integer;
- StartPos: Integer;
- Menu: RScenMenu;
- CMDS: TObjectList;
- Function IntReader(Pos: Integer): Integer;
- Function GetLine(Index: Integer): RLine;
- Procedure PutLine(Index: Integer; Text: ANSIString);
- Public
- Constructor Create(SeenFile: ANSIString);
- Destructor Destroy; Override;
- Property SLen: Integer read SourceLen;
- Property SMD5: String read SourceMD5;
- Property RAWText: ANSIString read Source;
- Property MPad: Integer read MenuPad;
- Property Ver: Integer read Version;
- Property ExPad: Integer read ExtraPad;
- Property Cntr: Integer read Counter;
- Property JMase: Integer read JumpBase;
- Property Start: Integer read StartPos;
- Property SHeader: RScenHeader read Header;
- Property SMenu: RScenMenu read Menu;
- Property SCMDS: TObjectList read CMDS;
- Property Lines[Index: Integer]: RLine read GetLine;
- end;
- Implementation
- Constructor RCMDTerm.Create(LError: String);
- BEGIN
- Inherited Create;
- ErrorMSG:= LError;
- END;
- Destructor RCMDTerm.Destroy;
- BEGIN
- Inherited;
- END;
- Constructor TScenario.Create(SeenFile: ANSIString);
- Var
- I, J, K, L: Integer;
- Pos, Str, Loop: Integer;
- CMDSerial: ANSIString;
- CMDItem: RScenCMD;
- BEGIN
- Inherited Create;
- Source:= SeenFile;
- SourceLen:= Length(Source);
- SourceMD5:= MD5(Source);
- Move(PChar(Source)^,Header,Sizeof(RScenHeader));
- IF Trim(String(Header.Sign)) <> ScenFileSignature then
- Raise Exception.Create(SeenScriptSignError);
- SetLength(IndexedLines,Header.LineCount);
- For I:= 0 to Header.LineCount-1 do
- IndexedLines[I].Index:= IntReader($21+I*4);
- MenuPad:= Header.LineCount * 4 + $50;
- Pos:= MenuPad+1;
- Version:= IntReader(Pos);
- if Version = 5 then ExtraPad:= 4
- else ExtraPad:= 0;
- Menu.Num:= IntReader(Pos-$24);
- Counter:= IntReader(Pos-$28)-1;
- // Reading Menu...
- Str:= 0;
- if Menu.Num > 8 then
- Raise Exception.Create(Format(SeenHeaderMenuCountError, [ Menu.Num ]));
- For I:= 1 to Menu.Num do
- BEGIN
- Menu.ID[I]:= ORD(Source[Pos]);
- Menu.SubNum[I]:= ORD(Source[Pos+1]);
- Inc(Pos,2);
- Menu.StrID[I]:= Str; Inc(Str);
- if Menu.SubNum[I] > 8 then
- Raise Exception.Create(Format(SeenHeaderSubMenuCountError, [ I, Menu.SubNum[I] ]));
- For J:= 1 to Menu.SubNum[I] do
- BEGIN
- Menu.SubID[I][J]:= ORD(Source[Pos]);
- Menu.SubCntMax[I][J]:= ORD(Source[Pos+1]);
- Inc(Pos,2);
- Menu.SubStrID[I][J]:= Str; Inc(Str);
- if Menu.SubCntMax[I][J] > 8 then
- Raise Exception.Create(Format(SeenHeaderSubMenuMaxError, [ I, J, Menu.SubCntMax[I][J] ]));
- For K:= 1 to Menu.SubCntMax[I][J] do
- BEGIN
- Loop:= ORD(Source[Pos]); Inc(Pos);
- if Loop > 8 then
- Raise Exception.Create(Format(SeenHeaderSubMenuLoopError, [ I, J, K, Loop ]));
- For L:= 1 to Loop do
- BEGIN
- Menu.Flag[I][J][K]:= ORD(Source[Pos]);
- Inc(Pos,3);
- END;
- END;
- END;
- END;
- For I:= 1 to Str do
- BEGIN
- Menu.Str[I]:= PChar(Copy(Source,Pos+1,SourceLen));
- Inc(Pos,ORD(Source[Pos])+1);
- END;
- Menu.Start:= IntReader(MenuPad+ExtraPad+$F+1) - 1;
- Loop:= Menu.Start + 1;
- StartPos:= MenuPad + ExtraPad + $13;
- IF Counter > 0 then
- BEGIN
- Menu.LoopBack:= Loop + 4;
- For I:= 1 to Counter do
- Inc(Loop,IntReader(StartPos + Loop + 1)+4);
- END;
- For I:= 1 to Menu.Num do
- For J:= 1 to Menu.SubNum[I] do
- For K:= 1 to Menu.SubCntMax[I][J] do
- BEGIN
- Menu.SubStart[I][J][K]:= Loop + 4;
- Inc(Loop,IntReader(StartPos + Loop + 1)+4);
- END;
- Menu.Cur:= -1;
- Menu.Bit:= 1;
- Menu.BitCnt:= 0;
- Menu.SubBit:= 1;
- Menu.SubBitCnt:= 0;
- JumpBase:= 0;
- CMDS:= TObjectList.Create(True);
- CMDSerial:= Copy(Source,StartPos+1,Length(Source));
- L:= Length(CMDSerial);
- Repeat
- Try
- CMDItem:= RScenCMD.Create(L, Header.LineCount, PutLine, CMDSerial);
- CMDS.Add(CMDItem);
- Except
- On E:Exception do
- BEGIN
- CMDS.Add(RCMDTerm.Create(E.Message));
- Break;
- END;
- END;
- Until CMDSerial = '';
- END;
- Destructor TScenario.Destroy;
- BEGIN
- FreeAndNIL(CMDS);
- SetLength(IndexedLines,0);
- Inherited;
- END;
- Function TScenario.IntReader(Pos: Integer): Integer;
- Var
- Cache: RMixInt;
- BEGIN
- Cache.Bytes[0]:= Source[Pos];
- Cache.Bytes[1]:= Source[Pos+1];
- Cache.Bytes[2]:= Source[Pos+2];
- Cache.Bytes[3]:= Source[Pos+3];
- Result:= Cache.AInt;
- END;
- Function TScenario.GetLine(Index: Integer): RLine;
- BEGIN
- IF Index < Length(IndexedLines) then
- Result:= IndexedLines[Index]
- else
- BEGIN
- Result.Index:= -1;
- Result.Text:= SeenHeaderGetTextError;
- END;
- END;
- Procedure TScenario.PutLine(Index: Integer; Text: ANSIString);
- BEGIN
- IndexedLines[Index].Text:= Text;
- END;
- Constructor RScenCMD.Create(OrigLen, LineMax: Integer; PutLine:PPutLineProc; Var CMDString: ANSIString);
- Var
- Counter: Integer;
- SizeCache: Integer;
- J, K, L, M: Integer;
- BEGIN
- Inherited Create;
- Source:= CMDString;
- SizeCache:= Length(Source);
- Offset:= OrigLen - SizeCache;
- IF NOT Assigned(PutLine) then Fault(SeenCMDTextExtractNIL,0);
- IF CMDString = '' then Fault(SeenCMDNIL,0);
- Counter:= 1;
- CMD:= ORD(Source[Counter]);
- Inc(Counter);
- Try
- Case CMD of
- $00, $01, $03, $06, $1A, $22..$29, $65:
- BEGIN
- Dec(Counter);
- END;
- $02, $04, $20, $30:
- BEGIN
- SCMD:= ORD(Source[Counter]);
- END;
- $05, $7F:
- BEGIN
- CMDIntR[1]:= ValueReader(Counter);
- Inc(Counter,CMDIntR[1].Spacing-1);
- END;
- $08:
- BEGIN
- SCMD:= ORD(Source[Counter]);
- Inc(Counter);
- Case SCMD of
- $01:
- BEGIN
- Dec(Counter);
- END;
- $10, $11:
- BEGIN
- CMDIntR[1]:= ValueReader(Counter);
- Inc(Counter,CMDIntR[1].Spacing-1);
- END;
- ELSE Dec(Counter);
- END;
- END;
- $0B:
- BEGIN
- SCMD:= ORD(Source[Counter]);
- Inc(Counter);
- Case SCMD of
- $01, $03, $05, $09, $10, $54:
- BEGIN
- CMDStrR[1]:= TextReader(Counter);
- Inc(Counter,CMDStrR[1].Spacing);
- CMDIntR[1]:= ValueReader(Counter);
- Inc(Counter,CMDIntR[1].Spacing-1);
- END;
- $02, $04, $06:
- BEGIN
- CMDStrR[1]:= TextReader(Counter);
- Inc(Counter,CMDStrR[1].Spacing);
- For J:= 1 to 15 do
- BEGIN
- CMDIntR[J]:= ValueReader(Counter);
- Inc(Counter,CMDIntR[J].Spacing);
- END;
- Dec(Counter);
- END;
- $08, $13, $30, $50:
- BEGIN
- Dec(Counter);
- END;
- $11:
- BEGIN
- CMDStrR[1]:= TextReader(Counter);
- Inc(Counter,CMDStrR[1].Spacing-1);
- END;
- $22:
- BEGIN
- K:= ORD(Source[Counter]);
- SetLength(CMDAStrR,K);
- SetLength(CMDAByte,K);
- SetLength(CMDAIntDR,K,7);
- Inc(Counter);
- CMDStrR[1]:= TextReader(Counter);
- Inc(Counter,CMDStrR[1].Spacing);
- CMDIntR[1]:= ValueReader(Counter);
- Inc(Counter,CMDIntR[1].Spacing);
- For J:= 0 to K-1 do
- BEGIN
- L:= ORD(Source[Counter]);
- Inc(Counter);
- CMDAByte[J]:= L;
- CMDAStrR[J]:= TextReader(Counter);
- Inc(Counter,CMDAStrR[J].Spacing);
- Case L of
- $01:
- BEGIN
- { NOTHING }
- END;
- $02:
- BEGIN
- CMDAIntDR[J][0]:= ValueReader(Counter);
- Inc(Counter,CMDAIntDR[J][0].Spacing);
- END;
- $03:
- BEGIN
- For M:= 0 to 5 do
- BEGIN
- CMDAIntDR[J][M]:= ValueReader(Counter);
- Inc(Counter,CMDAIntDR[J][M].Spacing);
- END;
- END;
- $04:
- BEGIN
- For M:= 0 to 6 do
- BEGIN
- CMDAIntDR[J][M]:= ValueReader(Counter);
- Inc(Counter,CMDAIntDR[J][M].Spacing);
- END;
- END;
- END;
- END;
- Dec(Counter);
- END;
- $24:
- BEGIN
- K:= ORD(Source[Counter]);
- SetLength(CMDAStrR,K);
- SetLength(CMDAByte,K);
- SetLength(CMDAIntDR,K,7);
- Inc(Counter);
- CMDIntR[1]:= ValueReader(Counter);
- Inc(Counter,CMDIntR[1].Spacing);
- CMDIntR[2]:= ValueReader(Counter);
- Inc(Counter,CMDIntR[2].Spacing);
- For J:= 0 to K-1 do
- BEGIN
- L:= ORD(Source[Counter]);
- Inc(Counter);
- CMDAByte[J]:= L;
- CMDAStrR[J]:= TextReader(Counter);
- Inc(Counter,CMDAStrR[J].Spacing);
- Case L of
- $01:
- BEGIN
- { NOTHING }
- END;
- $02:
- BEGIN
- CMDAIntDR[J][0]:= ValueReader(Counter);
- Inc(Counter,CMDAIntDR[J][0].Spacing);
- END;
- $03:
- BEGIN
- For M:= 0 to 5 do
- BEGIN
- CMDAIntDR[J][M]:= ValueReader(Counter);
- Inc(Counter,CMDAIntDR[J][M].Spacing);
- END;
- END;
- $04:
- BEGIN
- For M:= 0 to 6 do
- BEGIN
- CMDAIntDR[J][M]:= ValueReader(Counter);
- Inc(Counter,CMDAIntDR[J][M].Spacing);
- END;
- END;
- END;
- END;
- Dec(Counter);
- END;
- $31, $32, $33, $52:
- BEGIN
- CMDIntR[1]:= ValueReader(Counter);
- Inc(Counter,CMDIntR[1].Spacing-1);
- END;
- ELSE Dec(Counter);
- END;
- END;
- $0C:
- BEGIN
- SCMD:= ORD(Source[Counter]);
- Inc(Counter);
- Case SCMD of
- $10:
- BEGIN
- CMDStrR[1]:= TextReader(Counter);
- Inc(Counter,CMDStrR[1].Spacing);
- CMDIntR[1]:= ValueReader(Counter);
- Inc(Counter,CMDIntR[1].Spacing-1);
- END;
- $18:
- BEGIN
- CMDStrR[1]:= TextReader(Counter);
- Inc(Counter,CMDStrR[1].Spacing);
- CMDIntR[1]:= ValueReader(Counter);
- Inc(Counter,CMDIntR[1].Spacing);
- CMDStrR[2]:= TextReader(Counter);
- Inc(Counter,CMDStrR[2].Spacing-1);
- END;
- $12, $30, $20, $24:
- BEGIN
- CMDStrR[1]:= TextReader(Counter);
- Inc(Counter,CMDStrR[1].Spacing);
- K:= 1; L:= 0;
- While Source[Counter] <> #00 do
- BEGIN
- SetLength(CMDAIntR,K);
- CMDAIntR[L]:= ValueReader(Counter);
- Inc(Counter,CMDAIntR[L].Spacing);
- Inc(K); Inc(L);
- END;
- Dec(Counter);
- END;
- $13, $21, $25:
- BEGIN
- Dec(Counter);
- END;
- $16:
- BEGIN
- CMDStrR[1]:= TextReader(Counter);
- Inc(Counter,CMDStrR[1].Spacing);
- CMDIntR[1]:= ValueReader(Counter);
- Inc(Counter,CMDIntR[1].Spacing);
- CMDStrR[2]:= TextReader(Counter);
- Inc(Counter,CMDStrR[2].Spacing);
- CMDIntR[2]:= ValueReader(Counter);
- Inc(Counter,CMDIntR[2].Spacing-1);
- END;
- ELSE Dec(Counter);
- END;
- END;
- $0E:
- BEGIN
- SCMD:= ORD(Source[Counter]);
- Inc(Counter);
- Case SCMD of
- $01, $02, $03, $30, $32, $34:
- BEGIN
- CMDStrR[1]:= TextReader(Counter);
- Inc(Counter,CMDStrR[1].Spacing-1);
- END;
- $05, $06, $07, $31, $33, $35:
- BEGIN
- CMDStrR[1]:= TextReader(Counter);
- Inc(Counter,CMDStrR[1].Spacing);
- CMDIntR[1]:= ValueReader(Counter);
- Inc(Counter,CMDIntR[1].Spacing-1);
- END;
- $10, $20, $21, $37, $39, $40:
- BEGIN
- CMDIntR[1]:= ValueReader(Counter);
- Inc(Counter,CMDIntR[1].Spacing-1);
- END;
- $11, $12, $36, $38:
- BEGIN
- Dec(Counter);
- END;
- $22:
- BEGIN
- CMDIntR[1]:= ValueReader(Counter);
- Inc(Counter,CMDIntR[1].Spacing);
- CMDIntR[2]:= ValueReader(Counter);
- Inc(Counter,CMDIntR[2].Spacing-1);
- END;
- $50, $51, $52, $53:
- BEGIN
- CMDStrR[1]:= TextReader(Counter);
- Inc(Counter,CMDStrR[1].Spacing);
- For J:= 1 to 4 do
- BEGIN
- CMDIntR[J]:= ValueReader(Counter);
- Inc(Counter,CMDIntR[J].Spacing);
- END;
- Dec(Counter);
- END;
- $54, $55:
- BEGIN
- CMDStrR[1]:= TextReader(Counter);
- Inc(Counter,CMDStrR[1].Spacing);
- CMDStrR[2]:= TextReader(Counter);
- Inc(Counter,CMDStrR[2].Spacing);
- For J:= 1 to 4 do
- BEGIN
- CMDIntR[J]:= ValueReader(Counter);
- Inc(Counter,CMDIntR[J].Spacing);
- END;
- Dec(Counter);
- END;
- ELSE Dec(Counter);
- END;
- END;
- $10:
- BEGIN
- SCMD:= ORD(Source[Counter]);
- Inc(Counter);
- Case SCMD of
- $01, $03:
- BEGIN
- CMDIntR[1]:= ValueReader(Counter);
- Inc(Counter,CMDIntR[1].Spacing-1);
- END;
- $02:
- BEGIN
- CMDIntR[1]:= ValueReader(Counter);
- Inc(Counter,CMDIntR[1].Spacing);
- CMDIntR[2]:= ValueReader(Counter);
- Inc(Counter,CMDIntR[2].Spacing-1);
- END;
- ELSE Dec(Counter);
- END;
- END;
- $13:
- BEGIN
- SCMD:= ORD(Source[Counter]);
- Inc(Counter);
- Case SCMD of
- $01, $10:
- BEGIN
- CMDIntR[1]:= ValueReader(Counter);
- Inc(Counter,CMDIntR[1].Spacing-1);
- END;
- $02:
- BEGIN
- CMDIntR[1]:= ValueReader(Counter);
- Inc(Counter,CMDIntR[1].Spacing);
- CMDIntR[2]:= ValueReader(Counter);
- Inc(Counter,CMDIntR[2].Spacing-1);
- END;
- $03, $11:
- BEGIN
- CMDIntR[1]:= ValueReader(Counter);
- Inc(Counter,CMDIntR[1].Spacing);
- CMDIntR[2]:= ValueReader(Counter);
- Inc(Counter,CMDIntR[2].Spacing);
- CMDIntR[3]:= ValueReader(Counter);
- Inc(Counter,CMDIntR[3].Spacing-1);
- END;
- $04:
- BEGIN
- CMDIntR[1]:= ValueReader(Counter);
- Inc(Counter,CMDIntR[1].Spacing);
- CMDIntR[2]:= ValueReader(Counter);
- Inc(Counter,CMDIntR[2].Spacing);
- CMDIntR[3]:= ValueReader(Counter);
- Inc(Counter,CMDIntR[3].Spacing);
- CMDIntR[4]:= ValueReader(Counter);
- Inc(Counter,CMDIntR[4].Spacing-1);
- END;
- ELSE Dec(Counter);
- END;
- END;
- $15:
- BEGIN
- SetLength(CMDACond,1);
- CMDACond[0]:= Conditioner(Counter);
- Inc(Counter,CMDACond[0].Spacing);
- CMDInt[1]:= IntReader(Counter);
- Inc(Counter,3);
- END;
- $16:
- BEGIN
- SCMD:= ORD(Source[Counter]);
- Inc(Counter);
- CMDIntR[1]:= ValueReader(Counter);
- Inc(Counter,CMDIntR[1].Spacing-1);
- END;
- $17, $18, $2C, $31:
- BEGIN
- SCMD:= ORD(Source[Counter]);
- Inc(Counter);
- Case SCMD of
- $01:
- BEGIN
- CMDIntR[1]:= ValueReader(Counter);
- Inc(Counter,CMDIntR[1].Spacing-1);
- END;
- ELSE Dec(Counter);
- END;
- END;
- $19:
- BEGIN
- SCMD:= ORD(Source[Counter]);
- Inc(Counter);
- Case SCMD of
- $01, $04, $06:
- BEGIN
- CMDIntR[1]:= ValueReader(Counter);
- Inc(Counter,CMDIntR[1].Spacing-1);
- END;
- $02, $05:
- BEGIN
- CMDIntR[1]:= ValueReader(Counter);
- Inc(Counter,CMDIntR[1].Spacing);
- CMDIntR[2]:= ValueReader(Counter);
- Inc(Counter,CMDIntR[2].Spacing-1);
- END;
- $03, $10, $11, $12, $13:
- BEGIN
- Dec(Counter);
- END;
- ELSE Dec(Counter);
- END;
- END;
- $1B, $1C:
- BEGIN
- CMDInt[1]:= IntReader(Counter);
- Inc(Counter,3);
- END;
- $1D, $1E:
- BEGIN
- M:= ORD(Source[Counter]);
- CMDInt[1]:= M;
- Inc(Counter);
- CMDIntR[1]:= ValueReader(Counter);
- Inc(Counter,CMDIntR[1].Spacing);
- SetLength(CMDAInt,M);
- For L:= 0 to M-2 do
- BEGIN
- CMDAInt[L]:= IntReader(Counter);
- Inc(Counter,4);
- END;
- CMDInt[2]:= IntReader(Counter);
- Inc(Counter,3);
- END;
- $2D:
- BEGIN
- SCMD:= ORD(Source[Counter]);
- Inc(Counter);
- Case SCMD of
- $01, $02:
- BEGIN
- CMDIntR[1]:= ValueReader(Counter);
- Inc(Counter,CMDIntR[1].Spacing-1);
- END;
- $03, $04:
- BEGIN
- CMDIntR[1]:= ValueReader(Counter);
- Inc(Counter,CMDIntR[1].Spacing);
- CMDIntR[2]:= ValueReader(Counter);
- Inc(Counter,CMDIntR[2].Spacing-1);
- END;
- ELSE Dec(Counter);
- END;
- END;
- $2E:
- BEGIN
- SCMD:= ORD(Source[Counter]);
- Inc(Counter);
- Case SCMD of
- $01:
- BEGIN
- CMDIntR[1]:= ValueReader(Counter);
- Inc(Counter,CMDIntR[1].Spacing-1);
- END;
- $02:
- BEGIN
- CMDIntR[1]:= ValueReader(Counter);
- Inc(Counter,CMDIntR[1].Spacing);
- CMDIntR[2]:= ValueReader(Counter);
- Inc(Counter,CMDIntR[2].Spacing-1);
- END;
- ELSE Dec(Counter);
- END;
- END;
- $2F:
- BEGIN
- SCMD:= ORD(Source[Counter]);
- Inc(Counter);
- Case SCMD of
- $01:
- BEGIN
- CMDIntR[1]:= ValueReader(Counter);
- Inc(Counter,CMDIntR[1].Spacing);
- CMDIntR[2]:= ValueReader(Counter);
- Inc(Counter,CMDIntR[2].Spacing);
- CMDIntR[3]:= ValueReader(Counter);
- Inc(Counter,CMDIntR[3].Spacing-1);
- END;
- ELSE Dec(Counter);
- END;
- END;
- $37, $39, $3B..$43, $49..$51:
- BEGIN
- CMDIntR[1]:= ValueReader(Counter);
- Inc(Counter,CMDIntR[1].Spacing);
- CMDIntR[2]:= ValueReader(Counter);
- Inc(Counter,CMDIntR[2].Spacing-1);
- END;
- $56:
- BEGIN
- CMDIntR[1]:= ValueReader(Counter);
- Inc(Counter,CMDIntR[1].Spacing-1);
- END;
- $57:
- BEGIN
- CMDIntR[1]:= ValueReader(Counter);
- Inc(Counter,CMDIntR[1].Spacing);
- CMDIntR[2]:= ValueReader(Counter);
- Inc(Counter,CMDIntR[2].Spacing);
- CMDIntR[3]:= ValueReader(Counter);
- Inc(Counter,CMDIntR[3].Spacing-1);
- END;
- $58:
- BEGIN
- SCMD:= ORD(Source[Counter]);
- Inc(Counter);
- Case SCMD of
- $01, $02:
- BEGIN
- CMDIntR[1]:= ValueReader(Counter);
- Inc(Counter,CMDIntR[1].Spacing);
-
- SSCMD:= ORD(Source[Counter]);
- Inc(Counter);
- Case SSCMD of
- $22:
- BEGIN
- L:= 0;
- IF Source[Counter] = #$00 then Inc(Counter);
- Repeat
- SetLength(CMDASelR,L+1);
- CMDASelR[L].Text:= '';
- M:= ReadFString(Counter, True);
- Inc(Counter,M);
- IF Length(CMDACond) = 1 then
- CMDASelR[L].Condition:= CMDACond[0].Condition;
- For J:= 0 to High(CMDAStrR) do
- CMDASelR[L].Text:= CMDASelR[L].Text + CMDAStrR[J].Text;
- IF Source[Counter] = #$00 then Inc(Counter);
- Until Source[Counter] = #$23;
- END;
- ELSE Fault(SeenCMDSelectListError,Counter);
- END;
- END;
- $04:
- BEGIN
- CMDIntR[1]:= ValueReader(Counter);
- Inc(Counter,CMDIntR[1].Spacing-1);
- END;
- ELSE Dec(Counter);
- END;
- END;
- $59:
- BEGIN
- SCMD:= ORD(Source[Counter]);
- Inc(Counter);
- CMDIntR[1]:= ValueReader(Counter);
- Inc(Counter,CMDIntR[1].Spacing);
- Case SCMD of
- $01:
- BEGIN
- CMDStrR[1]:= TextReader(Counter);
- Inc(Counter,CMDStrR[1].Spacing-1);
- END;
- $02, $04, $05, $08:
- BEGIN
- CMDIntR[2]:= ValueReader(Counter);
- Inc(Counter,CMDIntR[2].Spacing-1);
- END;
- $03, $06:
- BEGIN
- CMDIntR[2]:= ValueReader(Counter);
- Inc(Counter,CMDIntR[2].Spacing);
- CMDIntR[3]:= ValueReader(Counter);
- Inc(Counter,CMDIntR[3].Spacing-1);
- END;
- $07:
- BEGIN
- Dec(Counter);
- END;
- ELSE Dec(Counter);
- END;
- END;
- $5B:
- BEGIN
- SCMD:= ORD(Source[Counter]);
- Inc(Counter);
- CMDIntR[1]:= ValueReader(Counter);
- Inc(Counter,CMDIntR[1].Spacing);
- Case SCMD of
- $01, $02:
- BEGIN
- L:= 0;
- Repeat
- SetLength(CMDAIntR,L+1);
- CMDAIntR[L]:= ValueReader(Counter);
- Inc(Counter,CMDAIntR[L].Spacing);
- Until Source[Counter] = #$00;
- END;
- ELSE Dec(Counter);
- END;
- END;
- $5C, $5D:
- BEGIN
- SCMD:= ORD(Source[Counter]);
- Inc(Counter);
- CMDIntR[1]:= ValueReader(Counter);
- Inc(Counter,CMDIntR[1].Spacing);
- CMDIntR[2]:= ValueReader(Counter);
- Inc(Counter,CMDIntR[2].Spacing);
- CMDIntR[3]:= ValueReader(Counter);
- Inc(Counter,CMDIntR[3].Spacing-1);
- END;
- $5E:
- BEGIN
- SCMD:= ORD(Source[Counter]);
- Inc(Counter);
- CMDIntR[1]:= ValueReader(Counter);
- Inc(Counter,CMDIntR[1].Spacing-1);
- END;
- $5F:
- BEGIN
- SCMD:= ORD(Source[Counter]);
- Inc(Counter);
- Case SCMD of
- $01:
- BEGIN
- CMDIntR[1]:= ValueReader(Counter);
- Inc(Counter,CMDIntR[1].Spacing);
- L:= 0; M:= 0;
- SetLength(CMDAByte,L+1);
- CMDAByte[L]:= ORD(Source[Counter]);
- Inc(Counter); Inc(L);
- Repeat
- Case CMDAByte[L-1] of
- $01, $11:
- BEGIN
- SetLength(CMDAIntR,M+1);
- CMDAIntR[M]:= ValueReader(Counter);
- Inc(Counter,CMDAIntR[M].Spacing); Inc(M);
- END;
- $02, $12:
- BEGIN
- SetLength(CMDAIntR,M+2);
- CMDAIntR[M]:= ValueReader(Counter);
- Inc(Counter,CMDAIntR[M].Spacing); Inc(M);
- CMDAIntR[M]:= ValueReader(Counter);
- Inc(Counter,CMDAIntR[M].Spacing); Inc(M);
- END;
- ELSE Fault(SeenCMDSumError,Counter);
- END;
- SetLength(CMDAByte,L+1);
- CMDAByte[L]:= ORD(Source[Counter]);
- Inc(Counter); Inc(L);
- Until CMDAByte[L-1] = 0;
- Dec(Counter);
- END;
- $10:
- BEGIN
- CMDIntR[1]:= ValueReader(Counter);
- Inc(Counter,CMDIntR[1].Spacing);
- CMDIntR[2]:= ValueReader(Counter);
- Inc(Counter,CMDIntR[2].Spacing);
- CMDIntR[3]:= ValueReader(Counter);
- Inc(Counter,CMDIntR[3].Spacing-1);
- END;
- $20:
- BEGIN
- M:= ORD(Source[Counter]);
- CMDInt[1]:= M;
- Inc(Counter);
- CMDIntR[1]:= ValueReader(Counter);
- Inc(Counter,CMDIntR[1].Spacing);
- CMDIntR[2]:= ValueReader(Counter);
- Inc(Counter,CMDIntR[2].Spacing);
- SetLength(CMDAIntR,M);
- For L:= 0 to M-1 do
- BEGIN
- CMDAIntR[L]:= ValueReader(Counter);
- Inc(Counter,CMDAIntR[L].Spacing);
- END;
- Dec(Counter);
- END;
- ELSE Dec(Counter);
- END;
- END;
- $60:
- BEGIN
- SCMD:= ORD(Source[Counter]);
- Inc(Counter);
- Case SCMD of
- $02, $03:
- BEGIN
- CMDIntR[1]:= ValueReader(Counter);
- Inc(Counter,CMDIntR[1].Spacing-1);
- END;
- $04:
- BEGIN
- M:= ReadFString(Counter);
- Inc(Counter, M);
- END;
- $05, $20:
- BEGIN
- Dec(Counter)
- END;
- $30, $31, $35, $36, $37:
- BEGIN
- CMDIntR[1]:= ValueReader(Counter);
- Inc(Counter,CMDIntR[1].Spacing);
- CMDIntR[2]:= ValueReader(Counter);
- Inc(Counter,CMDIntR[2].Spacing-1);
- END;
- ELSE Dec(Counter);
- END;
- END;
- $61:
- BEGIN
- SCMD:= ORD(Source[Counter]);
- Inc(Counter);
- Case SCMD of
- $01:
- BEGIN
- For L:= 1 to 10 do
- BEGIN
- CMDIntR[L]:= ValueReader(Counter);
- Inc(Counter,CMDIntR[L].Spacing);
- END;
- Dec(Counter);
- END;
- $02, $03, $20:
- BEGIN
- CMDIntR[1]:= ValueReader(Counter);
- Inc(Counter,CMDIntR[1].Spacing-1);
- END;
- $04:
- BEGIN
- Dec(Counter);
- END;
- $10,$11,$12:
- BEGIN
- CMDIntR[1]:= ValueReader(Counter);
- Inc(Counter,CMDIntR[1].Spacing);
- CMDIntR[2]:= ValueReader(Counter);
- Inc(Counter,CMDIntR[2].Spacing-1);
- END;
- $21:
- BEGIN
- CMDIntR[1]:= ValueReader(Counter);
- Inc(Counter,CMDIntR[1].Spacing);
- CMDStrR[1]:= TextReader(Counter);
- Inc(Counter,CMDStrR[1].Spacing);
- For L:= 2 to 10 do
- BEGIN
- CMDIntR[L]:= ValueReader(Counter);
- Inc(Counter,CMDIntR[L].Spacing);
- END;
- Dec(Counter);
- END;
- $24:
- BEGIN
- M:= ORD(Source[Counter]);
- CMDInt[1]:= M;
- Inc(Counter);
- SetLength(CMDAIntR,M);
- SetLength(CMDAStr,M);
- For L:= 0 to M-1 do
- BEGIN
- CMDAIntR[L]:= ValueReader(Counter);
- Inc(Counter,CMDAIntR[L].Spacing);
- J:= ReadFString(Counter);
- Inc(Counter,J);
- CMDAStr[L]:= '';
- For K:= 0 to High(CMDAStrR) do
- CMDAStr[L]:= CMDAStr[L] + CMDAStrR[K].Text;
- IF Source[Counter] = #00 then Inc(Counter);
- END;
- Dec(Counter);
- END;
- ELSE Dec(Counter);
- END;
- END;
- $63:
- BEGIN
- SCMD:= ORD(Source[Counter]);
- Inc(Counter);
- Case SCMD of
- $01:
- BEGIN
- For L:= 1 to 5 do
- BEGIN
- CMDIntR[L]:= ValueReader(Counter);
- Inc(Counter,CMDIntR[L].Spacing);
- END;
- Dec(Counter);
- END;
- $02:
- BEGIN
- For L:= 1 to 3 do
- BEGIN
- CMDIntR[L]:= ValueReader(Counter);
- Inc(Counter,CMDIntR[L].Spacing);
- END;
- Dec(Counter);
- END;
- $20:
- BEGIN
- CMDInt[1]:= ORD(Source[Counter]);
- Inc(Counter);
- CMDIntR[1]:= ValueReader(Counter);
- Inc(Counter,CMDIntR[1].Spacing-1);
- END;
- ELSE Dec(Counter);
- END;
- END;
- $64:
- BEGIN
- SCMD:= ORD(Source[Counter]);
- Inc(Counter);
- Case SCMD of
- $02, $04, $10:
- BEGIN
- For L:= 1 to 8 do
- BEGIN
- CMDIntR[L]:= ValueReader(Counter);
- Inc(Counter,CMDIntR[L].Spacing);
- END;
- Dec(Counter);
- END;
- $07, $11, $12, $20:
- BEGIN
- For L:= 1 to 5 do
- BEGIN
- CMDIntR[L]:= ValueReader(Counter);
- Inc(Counter,CMDIntR[L].Spacing);
- END;
- Dec(Counter);
- END;
- $15:
- BEGIN
- For L:= 1 to 9 do
- BEGIN
- CMDIntR[L]:= ValueReader(Counter);
- Inc(Counter,CMDIntR[L].Spacing);
- END;
- Dec(Counter);
- END;
- $30:
- BEGIN
- For L:= 1 to 10 do
- BEGIN
- CMDIntR[L]:= ValueReader(Counter);
- Inc(Counter,CMDIntR[L].Spacing);
- END;
- Dec(Counter);
- END;
- $32:
- BEGIN
- For L:= 1 to 16 do
- BEGIN
- CMDIntR[L]:= ValueReader(Counter);
- Inc(Counter,CMDIntR[L].Spacing);
- END;
- Dec(Counter);
- END;
- ELSE Dec(Counter);
- END;
- END;
- $66:
- BEGIN
- SCMD:= ORD(Source[Counter]);
- Inc(Counter);
- For L:= 1 to 6 do
- BEGIN
- CMDIntR[L]:= ValueReader(Counter);
- Inc(Counter,CMDIntR[L].Spacing);
- END;
- J:= ReadFString(Counter);
- CMDStr[1]:= '';
- For L:= 1 to High(CMDAStrR) do
- BEGIN
- CMDStr[1]:= CMDStr[1] + CMDAStrR[L].Text;
- END;
- Inc(Counter,J-1);
- END;
- $67:
- BEGIN
- SCMD:= ORD(Source[Counter]);
- Inc(Counter);
- Case SCMD of
- $00:
- BEGIN
- For L:= 1 to 6 do
- BEGIN
- CMDIntR[L]:= ValueReader(Counter);
- Inc(Counter,CMDIntR[L].Spacing);
- END;
- Dec(Counter);
- END;
- $01:
- BEGIN
- For L:= 1 to 9 do { 8 for earlier than 3217D }
- BEGIN
- CMDIntR[L]:= ValueReader(Counter);
- Inc(Counter,CMDIntR[L].Spacing);
- END;
- Dec(Counter);
- END;
- $02:
- BEGIN
- For L:= 1 to 9 do { 8 for earlier than 3216M }
- BEGIN
- CMDIntR[L]:= ValueReader(Counter);
- Inc(Counter,CMDIntR[L].Spacing);
- END;
- Dec(Counter);
- END;
- $03:
- BEGIN
- For L:= 1 to 11 do
- BEGIN
- CMDIntR[L]:= ValueReader(Counter);
- Inc(Counter,CMDIntR[L].Spacing);
- END;
- Dec(Counter);
- END;
- $05:
- BEGIN
- For L:= 1 to 8 do
- BEGIN
- CMDIntR[L]:= ValueReader(Counter);
- Inc(Counter,CMDIntR[L].Spacing);
- END;
- Dec(Counter);
- END;
- $08:
- BEGIN
- For L:= 1 to 9 do
- BEGIN
- CMDIntR[L]:= ValueReader(Counter);
- Inc(Counter,CMDIntR[L].Spacing);
- END;
- Dec(Counter);
- END;
- $11:
- BEGIN
- For L:= 1 to 3 do { 2 for earlier than 3217D }
- BEGIN
- CMDIntR[L]:= ValueReader(Counter);
- Inc(Counter,CMDIntR[L].Spacing);
- END;
- Dec(Counter);
- END;
- $12:
- BEGIN
- For L:= 1 to 3 do { 2 for earlier than 3216M }
- BEGIN
- CMDIntR[L]:= ValueReader(Counter);
- Inc(Counter,CMDIntR[L].Spacing);
- END;
- Dec(Counter);
- END;
- $20:
- BEGIN
- For L:= 1 to 15 do
- BEGIN
- CMDIntR[L]:= ValueReader(Counter);
- Inc(Counter,CMDIntR[L].Spacing);
- END;
- Dec(Counter);
- END;
- $21:
- BEGIN
- For L:= 1 to 16 do
- BEGIN
- CMDIntR[L]:= ValueReader(Counter);
- Inc(Counter,CMDIntR[L].Spacing);
- END;
- Dec(Counter);
- END;
- $22:
- BEGIN
- For L:= 1 to 18 do
- BEGIN
- CMDIntR[L]:= ValueReader(Counter);
- Inc(Counter,CMDIntR[L].Spacing);
- END;
- Dec(Counter);
- END;
- ELSE Dec(Counter);
- END;
- END;
- $68:
- BEGIN
- SCMD:= ORD(Source[Counter]);
- Inc(Counter);
- Case SCMD of
- $01:
- BEGIN
- For L:= 1 to 4 do
- BEGIN
- CMDIntR[L]:= ValueReader(Counter);
- Inc(Counter,CMDIntR[L].Spacing);
- END;
- Dec(Counter);
- END;
- $10:
- BEGIN
- For L:= 1 to 5 do
- BEGIN
- CMDIntR[L]:= ValueReader(Counter);
- Inc(Counter,CMDIntR[L].Spacing);
- END;
- Dec(Counter);
- END;
- ELSE Dec(Counter);
- END;
- END;
- $69:
- BEGIN
- CMDInt[1]:= ORD(Source[Counter]);
- Inc(Counter);
- CMDInt[2]:= ORD(Source[Counter]);
- Inc(Counter);
- For L:= 1 to 6 do
- BEGIN
- CMDIntR[L]:= ValueReader(Counter);
- Inc(Counter,CMDIntR[L].Spacing);
- END;
- Dec(Counter);
- END;
- $6A:
- BEGIN
- SCMD:= ORD(Source[Counter]);
- Inc(Counter);
- Case SCMD of
- $10, $20, $30:
- BEGIN
- CMDInt[1]:= ORD(Source[Counter]);
- Inc(Counter);
- M:= ORD(Source[Counter]);
- CMDInt[2]:= M;
- Inc(Counter);
- CMDIntR[1]:= ValueReader(Counter);
- Inc(Counter,CMDIntR[1].Spacing);
- CMDIntR[2]:= ValueReader(Counter);
- Inc(Counter,CMDIntR[2].Spacing);
- CMDIntR[3]:= ValueReader(Counter);
- Inc(Counter,CMDIntR[3].Spacing);
- IF SCMD = $30 then
- BEGIN
- CMDIntR[4]:= ValueReader(Counter);
- Inc(Counter,CMDIntR[4].Spacing);
- END;
- SetLength(CMDAIntR, M);
- SetLength(CMDAStrR, M);
- For L:= 0 to M-1 do
- BEGIN
- CMDAStrR[L]:= TextReader(Counter);
- Inc(Counter,CMDAStrR[L].Spacing);
- CMDAIntR[L]:= ValueReader(Counter);
- Inc(Counter,CMDAIntR[L].Spacing);
- END;
- { 1 Byte Extra Intended }
- END;
- $03, $04:
- BEGIN
- M:= ORD(Source[Counter]);
- CMDInt[1]:= M;
- Inc(Counter);
- CMDIntR[1]:= ValueReader(Counter);
- Inc(Counter,CMDIntR[1].Spacing);
- CMDIntR[2]:= ValueReader(Counter);
- Inc(Counter,CMDIntR[2].Spacing);
- SetLength(CMDAIntR, M);
- SetLength(CMDAStrR, M);
- For L:= 0 to M-1 do
- BEGIN
- CMDAStrR[L]:= TextReader(Counter);
- Inc(Counter,CMDAStrR[L].Spacing);
- CMDAIntR[L]:= ValueReader(Counter);
- Inc(Counter,CMDAIntR[L].Spacing);
- END;
- { 1 Byte Extra Intended }
- END;
- $05:
- BEGIN
- Dec(Counter);
- END;
- ELSE Dec(Counter);
- END;
- END;
- $6C:
- BEGIN
- SCMD:= ORD(Source[Counter]);
- Inc(Counter);
- Case SCMD of
- $02:
- BEGIN
- CMDStrR[1]:= TextReader(Counter);
- Inc(Counter,CMDStrR[1].Spacing);
- CMDStrR[2]:= TextReader(Counter);
- Inc(Counter,CMDStrR[2].Spacing-1);
- END;
- $03:
- BEGIN
- Dec(Counter);
- END;
- $04, $20:
- BEGIN
- CMDIntR[1]:= ValueReader(Counter);
- Inc(Counter,CMDIntR[1].Spacing);
- CMDIntR[2]:= ValueReader(Counter);
- Inc(Counter,CMDIntR[2].Spacing-1);
- END;
- $05:
- BEGIN
- CMDIntR[1]:= ValueReader(Counter);
- Inc(Counter,CMDIntR[1].Spacing);
- CMDIntR[2]:= ValueReader(Counter);
- Inc(Counter,CMDIntR[2].Spacing);
- CMDIntR[3]:= ValueReader(Counter);
- Inc(Counter,CMDIntR[3].Spacing);
- CMDIntR[4]:= ValueReader(Counter);
- Inc(Counter,CMDIntR[4].Spacing-1);
- END;
- $10, $11:
- BEGIN
- CMDIntR[1]:= ValueReader(Counter);
- Inc(Counter,CMDIntR[1].Spacing-1);
- END;
- $15:
- BEGIN
- CMDIntR[1]:= ValueReader(Counter);
- Inc(Counter,CMDIntR[1].Spacing);
- CMDIntR[2]:= ValueReader(Counter);
- Inc(Counter,CMDIntR[2].Spacing);
- CMDIntR[3]:= ValueReader(Counter);
- Inc(Counter,CMDIntR[3].Spacing-1);
- END;
- ELSE Dec(Counter);
- END;
- END;
- $6D:
- BEGIN
- SCMD:= ORD(Source[Counter]);
- Inc(Counter);
- Case SCMD of
- $01, $02:
- BEGIN
- CMDIntR[1]:= ValueReader(Counter);
- Inc(Counter,CMDIntR[1].Spacing);
- CMDIntR[2]:= ValueReader(Counter);
- Inc(Counter,CMDIntR[2].Spacing);
- CMDIntR[3]:= ValueReader(Counter);
- Inc(Counter,CMDIntR[3].Spacing-1);
- END;
- $03, $20, $21:
- BEGIN
- Dec(Counter);
- END;
- ELSE Dec(Counter);
- END;
- END;
- $6E:
- BEGIN
- SCMD:= ORD(Source[Counter]);
- Inc(Counter);
- Case SCMD of
- $01..$04:
- BEGIN
- CMDIntR[1]:= ValueReader(Counter);
- Inc(Counter,CMDIntR[1].Spacing-1);
- END;
- $05:
- BEGIN
- CMDIntR[1]:= ValueReader(Counter);
- Inc(Counter,CMDIntR[1].Spacing);
- CMDIntR[2]:= ValueReader(Counter);
- Inc(Counter,CMDIntR[2].Spacing);
- CMDIntR[3]:= ValueReader(Counter);
- Inc(Counter,CMDIntR[3].Spacing-1);
- END;
- ELSE Dec(Counter);
- END;
- END;
- $6F:
- BEGIN
- CMDIntR[1]:= ValueReader(Counter);
- Inc(Counter,CMDIntR[1].Spacing);
- CMDIntR[2]:= ValueReader(Counter);
- Inc(Counter,CMDIntR[2].Spacing);
- CMDIntR[3]:= ValueReader(Counter);
- Inc(Counter,CMDIntR[3].Spacing);
- CMDIntR[4]:= ValueReader(Counter);
- Inc(Counter,CMDIntR[4].Spacing-1);
- END;
- $70:
- BEGIN
- SCMD:= ORD(Source[Counter]);
- Inc(Counter);
- Case SCMD of
- $01, $02:
- BEGIN
- CMDIntR[1]:= ValueReader(Counter);
- Inc(Counter,CMDIntR[1].Spacing);
- CMDIntR[2]:= ValueReader(Counter);
- Inc(Counter,CMDIntR[2].Spacing);
- CMDIntR[3]:= ValueReader(Counter);
- Inc(Counter,CMDIntR[3].Spacing);
- CMDIntR[4]:= ValueReader(Counter);
- Inc(Counter,CMDIntR[4].Spacing-1);
- END;
- $03..$06, $10, $11:
- BEGIN
- CMDIntR[1]:= ValueReader(Counter);
- Inc(Counter,CMDIntR[1].Spacing-1);
- END;
- ELSE Dec(Counter);
- END;
- END;
- $72:
- BEGIN
- SCMD:= ORD(Source[Counter]);
- Inc(Counter);
- Case SCMD of
- $01..$05, $11..$15:
- BEGIN
- CMDIntR[1]:= ValueReader(Counter);
- Inc(Counter,CMDIntR[1].Spacing);
- CMDIntR[2]:= ValueReader(Counter);
- Inc(Counter,CMDIntR[2].Spacing-1);
- END;
- ELSE Dec(Counter);
- END;
- END;
- $73:
- BEGIN
- SCMD:= ORD(Source[Counter]);
- Inc(Counter);
- Case SCMD of
- $01, $02, $05, $06, $31:
- BEGIN
- CMDIntR[1]:= ValueReader(Counter);
- Inc(Counter,CMDIntR[1].Spacing);
- CMDIntR[2]:= ValueReader(Counter);
- Inc(Counter,CMDIntR[2].Spacing-1);
- END;
- $10..$13, $16..$30, $32..$34:
- BEGIN
- CMDIntR[1]:= ValueReader(Counter);
- Inc(Counter,CMDIntR[1].Spacing-1);
- END;
- ELSE Dec(Counter);
- END;
- END;
- $74:
- BEGIN
- SCMD:= ORD(Source[Counter]);
- Inc(Counter);
- Case SCMD of
- $01, $02:
- BEGIN
- CMDIntR[1]:= ValueReader(Counter);
- Inc(Counter,CMDIntR[1].Spacing-1);
- END;
- $03, $04:
- BEGIN
- CMDIntR[1]:= ValueReader(Counter);
- Inc(Counter,CMDIntR[1].Spacing);
- CMDIntR[2]:= ValueReader(Counter);
- Inc(Counter,CMDIntR[2].Spacing-1);
- END;
- ELSE Dec(Counter);
- END;
- END;
- $75:
- BEGIN
- SCMD:= ORD(Source[Counter]);
- Inc(Counter);
- CMDIntR[1]:= ValueReader(Counter);
- Inc(Counter,CMDIntR[1].Spacing-1);
- END;
- $76:
- BEGIN
- SCMD:= ORD(Source[Counter]);
- Inc(Counter);
- Case SCMD of
- $01, $02:
- BEGIN
- CMDIntR[1]:= ValueReader(Counter);
- Inc(Counter,CMDIntR[1].Spacing-1);
- END;
- $04, $05:
- BEGIN
- Dec(Counter);
- END;
- ELSE Dec(Counter);
- END;
- END;
- $FE, $FF:
- BEGIN
- CMDInt[1]:= IntReader(Counter);
- IF (CMDInt[1] >= 0) AND (CMDInt[1] < LineMax) then
- BEGIN
- Inc(Counter,4);
- CMDStrR[1]:= TextReader(Counter);
- Inc(Counter,CMDStrR[1].Spacing-1);
- IF Assigned(PutLine) then
- IF CMD = $FE then PutLine(CMDInt[1],Han2Zen(CMDStrR[1].Text))
- else PutLine(CMDInt[1],CMDStrR[1].Text);
- END
- else
- BEGIN
- CMDStrR[1]:= TextReader(Counter);
- Inc(Counter,CMDStrR[1].Spacing-1);
- END;
- END;
- ELSE
- BEGIN
- Dec(Counter);
- END;
- END;
- Finally
- Source:= Copy(Source,1,Counter);
- Delete(CMDString,1,Counter);
- END;
- END;
- Destructor RScenCMD.Destroy;
- Var
- Count: Integer;
- BEGIN
- SetLength(CMDAInt,0);
- SetLength(CMDAByte,0);
- SetLength(CMDAIntR,0);
- SetLength(CMDAIntDR,0,0);
- SetLength(CMDAStrR,0);
- For Count:= High(CMDACond) downto 0 do
- SetLength(CMDACond[Count].Condition,0);
- SetLength(CMDACond,0);
- For Count:= High(CMDASelR) downto 0 do
- SetLength(CMDASelR[Count].Condition,0);
- SetLength(CMDASelR,0);
- Inherited;
- END;
- Function RScenCMD.IntReader(Pos: Integer): Integer;
- Var
- Cache: RMixInt;
- BEGIN
- Cache.Bytes[0]:= Source[Pos];
- Cache.Bytes[1]:= Source[Pos+1];
- Cache.Bytes[2]:= Source[Pos+2];
- Cache.Bytes[3]:= Source[Pos+3];
- Result:= Cache.AInt;
- END;
- Function RScenCMD.ValueReader(Pos: Integer): RValue;
- Var
- VHeader: Byte;
- Count: Byte;
- BEGIN
- With Result do
- BEGIN
- VHeader:= ORD(Source[Pos]);
- Spacing:= ((VHeader SHR 4) AND $7);
- IF (Spacing = 0) OR (Spacing > 5) then Fault(SeenCMDValueHeaderError,Pos);
- IsRegister:= (VHeader AND $80) <> 0;
- Value:= 0;
- For Count:= 1 to Spacing - 1 do
- Value:= (Value SHL 8) + ORD(Source[Pos+Count]);
- Value:= (Value SHL 4) OR (VHeader AND $F);
- END;
- END;
- Function RScenCMD.TextReader(Pos: Integer): RText;
- Var
- ValueCache: RValue;
- BEGIN
- With Result do
- BEGIN
- Spacing:= 1;
- IF Source[Pos] = '@' then
- BEGIN
- IsRegister:= True;
- ValueCache:= ValueReader(Pos+Spacing);
- Inc(Spacing,ValueCache.Spacing);
- IsIndirect:= ValueCache.IsRegister;
- Value:= ValueCache.Value;
- END
- else
- BEGIN
- IsRegister:= False;
- Text:= PChar(Copy(Source,Pos,Length(Source)));
- Inc(Spacing,Length(Text));
- END;
- END;
- END;
- Function RScenCMD.Conditioner(Pos: Integer; ExpectAttr: Boolean): RCond;
- Const
- MAXLevels = 256;
- Var
- LevelCnt, OutCnt: Integer;
- AppendCond: Array[1..MAXLevels] of Byte;
- PastChar: Char;
- AttrVal: RValue;
- CMPVal1, CMPVal2: RValue;
- BEGIN
- With Result do
- BEGIN
- Spacing:= 0;
- LevelCnt:= 0;
- OutCnt:= 0;
- PastChar:= #$00;
- Repeat
- Case Source[Pos+Spacing] of
- #$28:
- BEGIN
- Inc(LevelCnt);
- IF LevelCnt > 256 then Fault(SeenCMDConditionLevelOverflow,Pos+Spacing);
- AppendCond[LevelCnt]:= 0;
- END;
- #$29:
- BEGIN
- IF LevelCnt >= 1 then
- IF AppendCond[LevelCnt] <> 0 then
- BEGIN
- SetLength(Condition,OutCnt+1);
- Condition[OutCnt].CType:= CPLOp;
- Condition[OutCnt].CValue:= AppendCond[LevelCnt];
- Inc(OutCnt);
- END;
- Dec(LevelCnt);
- END;
- #$26, #$27:
- BEGIN
- IF LevelCnt < 0 then Fault(SeenCMDConditionLOperPosError,Pos+Spacing);
- IF AppendCond[LevelCnt] <> 0 then // Slack Logic!! >_<
- BEGIN
- SetLength(Condition,OutCnt+1);
- Condition[OutCnt].CType:= CPLOp;
- Condition[OutCnt].CValue:= AppendCond[LevelCnt];
- Inc(OutCnt);
- END;
- AppendCond[LevelCnt]:= ORD(Source[Pos+Spacing]);
- END;
- #$58:
- BEGIN
- IF NOT ExpectAttr then Fault(SeenCMDConditionPropertyUnExp,Pos+Spacing);
- IF PastChar <> #$29 then Fault(SeenCMDConditionPropertyPosError,Pos+Spacing);
- SetLength(Condition,OutCnt+2);
- Condition[OutCnt+1].CType:= CPAttr;
- Condition[OutCnt+1].CValue:= ORD(Source[Pos+Spacing+1]);
- Case Source[Pos+Spacing+1] of
- #$20, #$22:
- BEGIN
- AttrVal:= ValueReader(Pos+Spacing+2);
- Condition[OutCnt].CType:= CPImm;
- Condition[OutCnt].CValue:= AttrVal.Value;
- END;
- #$21:
- BEGIN
- AttrVal.Spacing:= 0;
- Condition[OutCnt].CType:= CPImm;
- Condition[OutCnt].CValue:= 0;
- END;
- ELSE Fault(SeenCMDConditionPropertyError,Pos+Spacing);
- END;
- Inc(Spacing,AttrVal.Spacing+1);
- Inc(OutCnt,2);
- END;
- #$36..#$3B, #$41..#$49, #$4F..#$55:
- BEGIN
- CMPVal1:= ValueReader(Pos+Spacing+1);
- CMPVal2:= ValueReader(Pos+Spacing+CMPVal1.Spacing+1);
- SetLength(Condition,OutCnt+3);
- Condition[OutCnt].CValue:= CMPVal1.Value;
- Condition[OutCnt+1].CValue:= CMPVal2.Value;
- Condition[OutCnt+2].CValue:= ORD(Source[Pos+Spacing]);
- Condition[OutCnt+2].CType:= CPLOp;
- Case Source[Pos+Spacing] of
- #$36, #$37:
- BEGIN
- Condition[OutCnt].CType:= CPRBit;
- Condition[OutCnt+1].CType:= CPImm;
- END;
- #$38, #$39:
- BEGIN
- Condition[OutCnt].CType:= CPRBit;
- Condition[OutCnt+1].CType:= CPRBit
- END;
- #$3A, #$3B, #$41..#$47:
- BEGIN
- Condition[OutCnt].CType:= CPRInt;
- Condition[OutCnt+1].CType:= CPImm;
- END;
- #$48, #$49, #$4F..#$55:
- BEGIN
- Condition[OutCnt].CType:= CPRInt;
- Condition[OutCnt+1].CType:= CPRInt;
- END;
- END;
- Inc(Spacing,CMPVal1.Spacing+CMPVal2.Spacing);
- Inc(OutCnt,3);
- END;
- ELSE Fault(SeenCMDConditionError,Pos+Spacing);
- END;
- PastChar:= Source[Pos+Spacing];
- Inc(Spacing);
- Until (LevelCnt <= 0);
- END;
- END;
- Function RScenCMD.ReadFString(Pos: Integer; ExpectAttr: Boolean = False): Integer;
- Var
- CondCounter: Integer;
- TextCounter: Integer;
- ValueCache: RValue;
- BEGIN
- SetLength(CMDAStrR,0);
- For CondCounter:= High(CMDACond) downto 0 do
- SetLength(CMDACond[CondCounter].Condition,0);
- SetLength(CMDACond,0);
- CondCounter:= 0;
- TextCounter:= 0;
- Result:= 0;
- Repeat
- Case Source[Pos+Result] of
- #$FF, #$FE:
- BEGIN
- SetLength(CMDAStrR,TextCounter+1);
- CMDAStrR[TextCounter].IsRegister:= False;
- CMDAStrR[TextCounter].Text:= PChar(Copy(Source,Pos+Result+1,Length(Source)));
- CMDAStrR[TextCounter].Spacing:= Length(CMDAStrR[TextCounter].Text);
- IF Source[Pos+Result] = #$FE then
- CMDAStrR[TextCounter].Text:= Han2Zen(CMDAStrR[TextCounter].Text);
- Inc(Result,CMDAStrR[TextCounter].Spacing+1);
- Inc(TextCounter);
- END;
- #$FD:
- BEGIN
- SetLength(CMDAStrR,TextCounter+1);
- CMDAStrR[TextCounter].IsRegister:= True;
- ValueCache:= ValueReader(Pos+Result+1);
- CMDAStrR[TextCounter].Spacing:= ValueCache.Spacing;
- CMDAStrR[TextCounter].IsIndirect:= ValueCache.IsRegister;
- CMDAStrR[TextCounter].Value:= ValueCache.Value;
- Inc(Result,CMDAStrR[TextCounter].Spacing+1);
- Inc(TextCounter);
- END;
- #$28:
- BEGIN
- IF CondCounter <> 0 then Fault(SeenCMDFStringConditionError,Pos+Result);
- SetLength(CMDACond,CondCounter+1);
- CMDACond[CondCounter]:= Conditioner(Pos+Result,ExpectAttr);
- Inc(Result,CMDACond[CondCounter].Spacing);
- Inc(CondCounter);
- END;
- #$10:
- BEGIN
- Inc(Result);
- Case Source[Result] of
- #$03:
- BEGIN
- SetLength(CMDAStrR,TextCounter+1);
- CMDAStrR[TextCounter].IsRegister:= True;
- ValueCache:= ValueReader(Pos+Result+1);
- CMDAStrR[TextCounter].Spacing:= ValueCache.Spacing;
- CMDAStrR[TextCounter].IsIndirect:= ValueCache.IsRegister;
- CMDAStrR[TextCounter].Value:= ValueCache.Value;
- Inc(Result,CMDAStrR[TextCounter].Spacing+1);
- Inc(TextCounter);
- END;
- ELSE Fault(SeenCMDFString10hSubCMDError,Pos+Result);
- END;
- END;
- ELSE Break; // Fault(SeenCMDFStringError,Pos+Result); { Allow for NO String }
- END;
- Inc(Result);
- Until Source[Pos+Result] = #0;
- END;
- Function RScenCMD.Han2Zen(StrIn: ANSIString): ANSIString;
- Const
- H2ZTable: Array[#$20..#$7F] of Char = (
- #$40, #$49, #$68, #$94, #$90, #$93, #$95, #$66, #$69, #$6A, #$96, #$7B, #$43, #$7C, #$44, #$5E,
- #$4F, #$50, #$51, #$52, #$53, #$54, #$55, #$56, #$57, #$58, #$46, #$47, #$83, #$81, #$84, #$48,
- #$97, #$60, #$61, #$62, #$63, #$64, #$65, #$66, #$67, #$68, #$69, #$6A, #$6B, #$6C, #$6D, #$6E,
- #$6F, #$70, #$71, #$72, #$73, #$74, #$75, #$76, #$77, #$78, #$79, #$6D, #$8F, #$6E, #$4F, #$51,
- #$65, #$81, #$82, #$83, #$84, #$85, #$86, #$87, #$88, #$89, #$8A, #$8B, #$8C, #$8D, #$8E, #$8F,
- #$90, #$91, #$92, #$93, #$94, #$95, #$96, #$97, #$98, #$99, #$9A, #$6F, #$62, #$70, #$60, #$45
- );
- Var
- Count, Len: Integer;
- Ch: Char;
- BEGIN
- Len:= Length(StrIn);
- Result:= '';
- For Count:= 1 to Len do
- BEGIN
- Ch:= StrIn[Count];
- IF Ch in [#$20..#$80] then
- IF (Ch in ['0'..'9']) OR (Ch in ['0'..'9']) OR (Ch in ['0'..'9']) then
- Result:= Result + #$82 + H2ZTable[Ch]
- else Result:= Result + #$81 + H2ZTable[Ch]
- else Result:= Result + Ch;
- END;
- END;
- Function RScenCMD.Explain(Detail: Boolean): String;
- BEGIN
- IF Source = '' then Result:= SeenCMDExpEmpty;
- Detail:= False;
- IF NOT Detail then
- Case CMD of
- $00: Result:= SeenCMDExpCat01;
- $01: Result:= SeenCMDExpCat02;
- $02: Result:= SeenCMDExpCat03;
- $03: Result:= SeenCMDExpCat04;
- $04: Result:= SeenCMDExpCat05;
- $05: Result:= SeenCMDExpCat06;
- $0B: Result:= SeenCMDExpCat07;
- $0C: Result:= SeenCMDExpCat08;
- $0E: Result:= SeenCMDExpCat09;
- $10: Result:= SeenCMDExpCat10;
- $13: Result:= SeenCMDExpCat11;
- $15: Result:= SeenCMDExpCat12;
- $16: Result:= SeenCMDExpCat13;
- $17: Result:= SeenCMDExpCat14;
- $18: Result:= SeenCMDExpCat15;
- $19: Result:= SeenCMDExpCat16;
- $1B: Result:= SeenCMDExpCat17;
- $1C: Result:= SeenCMDExpCat18;
- $1D: Result:= SeenCMDExpCat19;
- $1E: Result:= SeenCMDExpCat20;
- $20: Result:= SeenCMDExpCat21;
- $37: Result:= SeenCMDExpCat22;
- $39: Result:= SeenCMDExpCat23;
- $3B: Result:= SeenCMDExpCat24;
- $3C: Result:= SeenCMDExpCat25;
- $3D: Result:= SeenCMDExpCat26;
- $3E: Result:= SeenCMDExpCat27;
- $3F: Result:= SeenCMDExpCat28;
- $40: Result:= SeenCMDExpCat29;
- $41: Result:= SeenCMDExpCat30;
- $42: Result:= SeenCMDExpCat31;
- $43: Result:= SeenCMDExpCat32;
- $49: Result:= SeenCMDExpCat33;
- $4A: Result:= SeenCMDExpCat34;
- $4B: Result:= SeenCMDExpCat35;
- $4C: Result:= SeenCMDExpCat36;
- $4D: Result:= SeenCMDExpCat37;
- $4E: Result:= SeenCMDExpCat38;
- $4F: Result:= SeenCMDExpCat39;
- $50: Result:= SeenCMDExpCat40;
- $51: Result:= SeenCMDExpCat41;
- $56: Result:= SeenCMDExpCat42;
- $57: Result:= SeenCMDExpCat43;
- $58: Result:= SeenCMDExpCat44;
- $59: Result:= SeenCMDExpCat45;
- $5B: Result:= SeenCMDExpCat46;
- $5C: Result:= SeenCMDExpCat47;
- $5D: Result:= SeenCMDExpCat48;
- $5E: Result:= SeenCMDExpCat49;
- $5F: Result:= SeenCMDExpCat50;
- $60: Result:= SeenCMDExpCat51;
- $61: Result:= SeenCMDExpCat52;
- $63: Result:= SeenCMDExpCat53;
- $64: Result:= SeenCMDExpCat54;
- $66: Result:= SeenCMDExpCat55;
- $67: Result:= SeenCMDExpCat56;
- $68: Result:= SeenCMDExpCat57;
- $69: Result:= SeenCMDExpCat58;
- $6A: Result:= SeenCMDExpCat59;
- $6C: Result:= SeenCMDExpCat60;
- $6D: Result:= SeenCMDExpCat61;
- $6E: Result:= SeenCMDExpCat62;
- $70: Result:= SeenCMDExpCat63;
- $72: Result:= SeenCMDExpCat64;
- $73: Result:= SeenCMDExpCat65;
- $74: Result:= SeenCMDExpCat66;
- $75: Result:= SeenCMDExpCat67;
- $76: Result:= SeenCMDExpCat68;
- $FE: Result:= SeenCMDExpCat69;
- $FF: Result:= SeenCMDExpCat70;
- ELSE Result:= Format(SeenCMDExpCatXX, [ CMD, SCMD ]);
- END
- ELSE
- Result:= Format(SeenCMDExplainDetailUnImp, [ CMD, SCMD ]);
- Result:= '[' + IntToStr(Offset) + ':' + IntToStr(Length(Source))+ '] ' + Result;
- END;
- Procedure RScenCMD.Fault(Error: String; Pos: Integer);
- Var
- RAWDump: String;
- Count, Len: Integer;
- BEGIN
- RAWDump:= '';
- IF Source <> '' then
- BEGIN
- RAWDump:= SeenCMDFaultHeader;
- Len:= Length(Source);
- For Count:= 1 to Pos do
- IF Count <= Len then
- RAWDump:= RAWDump + ' ' + IntToHex(ORD(Source[Count]),2);
- END;
- Raise Exception.Create('[' + IntToStr(Offset) + '] $' + IntToHex(CMD,2) + ':$' + IntToHex(SCMD,2) + ' ' + Error + ' | ' + RAWDump);
- END;
- Procedure RScenCMD.ExpressTree(Tree: TTreeView; Root: TTreeNode);
- Var
- TempRoot: TTreeNode;
- TempChild: TTreeNode;
- BEGIN
- IF Source = '' then
- BEGIN
- TempRoot:= Tree.Items.AddChild(Root,SeenCMDExpEmpty);
- TempRoot.ImageIndex:= 3;
- TempRoot.SelectedIndex:= 3;
- Exit;
- END;
- TempRoot:= Tree.Items.AddChild(Root,Explain(True));
- Case CMD of
- $00:
- BEGIN
- TempRoot.ImageIndex:= 20;
- TempRoot.SelectedIndex:= 20;
- END;
- $01:
- BEGIN
- TempRoot.ImageIndex:= 6;
- TempRoot.SelectedIndex:= 6;
- END;
- $02:
- BEGIN
- TempRoot.ImageIndex:= 8;
- TempRoot.SelectedIndex:= 8;
- END;
- $03:
- BEGIN
- TempRoot.ImageIndex:= 6;
- TempRoot.SelectedIndex:= 6;
- END;
- $04:
- BEGIN
- TempRoot.ImageIndex:= 8;
- TempRoot.SelectedIndex:= 8;
- END;
- $05:
- BEGIN
- TempRoot.ImageIndex:= 8;
- TempRoot.SelectedIndex:= 8;
- END;
- $0B:
- BEGIN
- TempRoot.ImageIndex:= 2;
- TempRoot.SelectedIndex:= 10;
- END;
- $0C:
- BEGIN
- TempRoot.ImageIndex:= 9;
- TempRoot.SelectedIndex:= 10;
- END;
- $0E:
- BEGIN
- TempRoot.ImageIndex:= 0;
- TempRoot.SelectedIndex:= 10;
- END;
- $10:
- BEGIN
- TempRoot.ImageIndex:= 8;
- TempRoot.SelectedIndex:= 8;
- END;
- $13:
- BEGIN
- TempRoot.ImageIndex:= 2;
- TempRoot.SelectedIndex:= 10;
- END;
- $15:
- BEGIN
- TempRoot.ImageIndex:= 14;
- TempRoot.SelectedIndex:= 14;
- END;
- $16:
- BEGIN
- TempRoot.ImageIndex:= 14;
- TempRoot.SelectedIndex:= 14;
- END;
- $17:
- BEGIN
- TempRoot.ImageIndex:= 2;
- TempRoot.SelectedIndex:= 2;
- END;
- $18:
- BEGIN
- TempRoot.ImageIndex:= 8;
- TempRoot.SelectedIndex:= 8;
- END;
- $19:
- BEGIN
- TempRoot.ImageIndex:= 18;
- TempRoot.SelectedIndex:= 18;
- END;
- $1B:
- BEGIN
- TempRoot.ImageIndex:= 14;
- TempRoot.SelectedIndex:= 14;
- END;
- $1C:
- BEGIN
- TempRoot.ImageIndex:= 14;
- TempRoot.SelectedIndex:= 14;
- END;
- $1D:
- BEGIN
- TempRoot.ImageIndex:= 14;
- TempRoot.SelectedIndex:= 14;
- END;
- $1E:
- BEGIN
- TempRoot.ImageIndex:= 14;
- TempRoot.SelectedIndex:= 14;
- END;
- $20:
- BEGIN
- TempRoot.ImageIndex:= 14;
- TempRoot.SelectedIndex:= 14;
- END;
- $37:
- BEGIN
- TempRoot.ImageIndex:= 4;
- TempRoot.SelectedIndex:= 4;
- END;
- $39:
- BEGIN
- TempRoot.ImageIndex:= 4;
- TempRoot.SelectedIndex:= 4;
- END;
- $3B:
- BEGIN
- TempRoot.ImageIndex:= 4;
- TempRoot.SelectedIndex:= 4;
- END;
- $3C:
- BEGIN
- TempRoot.ImageIndex:= 4;
- TempRoot.SelectedIndex:= 4;
- END;
- $3D:
- BEGIN
- TempRoot.ImageIndex:= 4;
- TempRoot.SelectedIndex:= 4;
- END;
- $3E:
- BEGIN
- TempRoot.ImageIndex:= 4;
- TempRoot.SelectedIndex:= 4;
- END;
- $3F:
- BEGIN
- TempRoot.ImageIndex:= 4;
- TempRoot.SelectedIndex:= 4;
- END;
- $40:
- BEGIN
- TempRoot.ImageIndex:= 4;
- TempRoot.SelectedIndex:= 4;
- END;
- $41:
- BEGIN
- TempRoot.ImageIndex:= 4;
- TempRoot.SelectedIndex:= 4;
- END;
- $42:
- BEGIN
- TempRoot.ImageIndex:= 4;
- TempRoot.SelectedIndex:= 4;
- END;
- $43:
- BEGIN
- TempRoot.ImageIndex:= 4;
- TempRoot.SelectedIndex:= 4;
- END;
- $49:
- BEGIN
- TempRoot.ImageIndex:= 4;
- TempRoot.SelectedIndex:= 4;
- END;
- $4A:
- BEGIN
- TempRoot.ImageIndex:= 4;
- TempRoot.SelectedIndex:= 4;
- END;
- $4B:
- BEGIN
- TempRoot.ImageIndex:= 4;
- TempRoot.SelectedIndex:= 4;
- END;
- $4C:
- BEGIN
- TempRoot.ImageIndex:= 4;
- TempRoot.SelectedIndex:= 4;
- END;
- $4D:
- BEGIN
- TempRoot.ImageIndex:= 4;
- TempRoot.SelectedIndex:= 4;
- END;
- $4E:
- BEGIN
- TempRoot.ImageIndex:= 4;
- TempRoot.SelectedIndex:= 4;
- END;
- $4F:
- BEGIN
- TempRoot.ImageIndex:= 4;
- TempRoot.SelectedIndex:= 4;
- END;
- $50:
- BEGIN
- TempRoot.ImageIndex:= 4;
- TempRoot.SelectedIndex:= 4;
- END;
- $51:
- BEGIN
- TempRoot.ImageIndex:= 4;
- TempRoot.SelectedIndex:= 4;
- END;
- $56:
- BEGIN
- TempRoot.ImageIndex:= 4;
- TempRoot.SelectedIndex:= 4;
- END;
- $57:
- BEGIN
- TempRoot.ImageIndex:= 4;
- TempRoot.SelectedIndex:= 4;
- END;
- $58:
- BEGIN
- TempRoot.ImageIndex:= 22;
- TempRoot.SelectedIndex:= 10;
- END;
- $59:
- BEGIN
- TempRoot.ImageIndex:= 4;
- TempRoot.SelectedIndex:= 4;
- END;
- $5B:
- BEGIN
- TempRoot.ImageIndex:= 4;
- TempRoot.SelectedIndex:= 4;
- END;
- $5C:
- BEGIN
- TempRoot.ImageIndex:= 4;
- TempRoot.SelectedIndex:= 4;
- END;
- $5D:
- BEGIN
- TempRoot.ImageIndex:= 4;
- TempRoot.SelectedIndex:= 4;
- END;
- $5E:
- BEGIN
- TempRoot.ImageIndex:= 12;
- TempRoot.SelectedIndex:= 12;
- END;
- $5F:
- BEGIN
- TempRoot.ImageIndex:= 4;
- TempRoot.SelectedIndex:= 4;
- END;
- $60:
- BEGIN
- TempRoot.ImageIndex:= 13;
- TempRoot.SelectedIndex:= 13;
- END;
- $61:
- BEGIN
- TempRoot.ImageIndex:= 6;
- TempRoot.SelectedIndex:= 10;
- END;
- $63:
- BEGIN
- TempRoot.ImageIndex:= 2;
- TempRoot.SelectedIndex:= 2;
- END;
- $64:
- BEGIN
- TempRoot.ImageIndex:= 2;
- TempRoot.SelectedIndex:= 10;
- END;
- $66:
- BEGIN
- TempRoot.ImageIndex:= 2;
- TempRoot.SelectedIndex:= 2;
- END;
- $67:
- BEGIN
- TempRoot.ImageIndex:= 2;
- TempRoot.SelectedIndex:= 2;
- END;
- $68:
- BEGIN
- TempRoot.ImageIndex:= 2;
- TempRoot.SelectedIndex:= 2;
- END;
- $69:
- BEGIN
- TempRoot.ImageIndex:= 2;
- TempRoot.SelectedIndex:= 10;
- END;
- $6A:
- BEGIN
- TempRoot.ImageIndex:= 2;
- TempRoot.SelectedIndex:= 10;
- END;
- $6C:
- BEGIN
- TempRoot.ImageIndex:= 19;
- TempRoot.SelectedIndex:= 10;
- END;
- $6D:
- BEGIN
- TempRoot.ImageIndex:= 5;
- TempRoot.SelectedIndex:= 5;
- END;
- $6E:
- BEGIN
- TempRoot.ImageIndex:= 2;
- TempRoot.SelectedIndex:= 10;
- END;
- $70:
- BEGIN
- TempRoot.ImageIndex:= 7;
- TempRoot.SelectedIndex:= 10;
- END;
- $72:
- BEGIN
- TempRoot.ImageIndex:= 7;
- TempRoot.SelectedIndex:= 10;
- END;
- $73:
- BEGIN
- TempRoot.ImageIndex:= 7;
- TempRoot.SelectedIndex:= 10;
- END;
- $74:
- BEGIN
- TempRoot.ImageIndex:= 15;
- TempRoot.SelectedIndex:= 10;
- END;
- $75:
- BEGIN
- TempRoot.ImageIndex:= 11;
- TempRoot.SelectedIndex:= 11;
- END;
- $76:
- BEGIN
- TempRoot.ImageIndex:= 7;
- TempRoot.SelectedIndex:= 7;
- END;
- $FE:
- BEGIN
- TempRoot.ImageIndex:= 8;
- TempRoot.SelectedIndex:= 8;
- END;
- $FF:
- BEGIN
- TempRoot.ImageIndex:= 8;
- TempRoot.SelectedIndex:= 8;
- END;
- ELSE
- BEGIN
- TempRoot.ImageIndex:= 17;
- TempRoot.SelectedIndex:= 17;
- END;
- END;
- END;
- END.
复制代码注:
1. MD5什么的可以忽略不计,脚本中没有这个指令,引擎也不会做这个操作,是我后来(心血来潮)加进去的 =v=
2. Tree / Node什么的也可以忽略掉,这个是为了将指令映射到图形界面上,和引擎/指令没有关系。
3. 关键就在TScenario(分析脚本头部格式)和RScenCMD(对每个指令进行解码)。
其中RScenCMD实现了对命令流的自动解析,在构建指令对象的时候,新的指令的类型和参数就被自动分析出来放到对应的成员中去了。