⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 op.pas

📁 dede 的源代码 3.10b
💻 PAS
📖 第 1 页 / 共 3 页
字号:
  end;
  Result := true;
end ;

function xchgArg(D,A1,A2: integer): boolean;
begin
  Result := false;
  case D of
    $0: begin
        SetCmdArg(A1);
        SetCmdArg(A2);
      end;
    $1: begin
        SetCmdArg(A2);
        SetCmdArg(A1);
      end;
    else Exit;
  end;
  Result := true;
end ;

function readRMD(W: integer): boolean;
var
  R,A: integer;
var
  _1: integer;
begin
  Result := false;
  if not getEAV(W,R,A) then Exit;
  if not Reg(W,R,_1) then Exit;
  SetCmdArg(_1);
  SetCmdArg(A);
  Result := true;
end ;

function readRMR(W: integer): boolean;
var
  R,A: integer;
var
  _1: integer;
begin
  Result := false;
  if not getEAV(W,R,A) then Exit;
  SetCmdArg(A);
  if not Reg(W,R,_1) then Exit;
  SetCmdArg(_1);
  Result := true;
end ;

function readRM(R,W: integer): boolean;
begin
  Result := false;
  case R of
    $0: if not readRMR(W) then Exit;
    $1: if not readRMD(W) then Exit;
    else Exit;
  end;
  Result := true;
end ;

function readSRM(Rev: integer): boolean;
var
  R,A: integer;
begin
  Result := false;
  if not getEA(1,R,A) then Exit;
  case Rev of
    $0: begin
        SetCmdArg(A);
        SetCmdArg(ntSReg[R]);
      end;
    $1: begin
        SetCmdArg(ntSReg[R]);
        SetCmdArg(A);
      end;
    else Exit;
  end;
  Result := true;
end ;

function ReadRMWD(W: integer): boolean;
var
  R,A: integer;
var
  _1: integer;
begin
  Result := false;
  if not getEA(W,R,A) then Exit;
  if not RegW(R,_1) then Exit;
  SetCmdArg(_1);
  SetCmdArg(A);
  Result := true;
end ;

function ReadMIm(W: integer): boolean;
var
  R,A: integer;
begin
  Result := false;
  if not getEAV(W,R,A) then Exit;
  SetCmdArg(A);
  if not imW(W) then Exit;
  Result := true;
end ;

function CurSeg: boolean;
var
  S: integer;
begin
  Result := false;
  S := getSeg;
  case S and $F of
    $8: ;
    else SetCmdArg(ntSReg[S]);
  end;
  Result := true;
end ;

function ReadPM: boolean;
var
  B0,M,A,B1,C,R,D,W: integer;
var
  _1: integer;

const
  _C0: array[0..$FF] of integer = (
    {0x00}  0,  1,  2,  3, 49,  4,  5, 49,  6,  7, 49,  8, 49, 49, 49, 49,
    {0x10} 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
    {0x20}  9, 10, 11, 12, 13, 49, 14, 49, 49, 49, 49, 49, 49, 49, 49, 49,
    {0x30} 15, 16, 17, 18, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
    {0x40} 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
    {0x50} 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
    {0x60} 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
    {0x70} 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
    {0x80} 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
    {0x90} 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
    {0xA0} 22, 23, 24, 25, 26, 27, 28, 28, 29, 30, 31, 32, 33, 34, 49, 35,
    {0xB0} 49, 49, 36, 37, 38, 39, 40, 40, 49, 41, 42, 43, 44, 45, 46, 46,
    {0xC0} 47, 47, 49, 49, 49, 49, 49, 49, 48, 48, 48, 48, 48, 48, 48, 48,
    {0xD0} 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
    {0xE0} 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
    {0xF0} 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49
  );

begin
  Result := false;
  if not ReadByte(B0) then Exit;
  case _C0[B0 and $FF] of
    0: begin
        if not getEA(1,M,A) then Exit;
        SetOpName(ntGr6Op[M]);
        SetCmdArg(A);
      end;
    1: begin
        if not getEA(1,M,A) then Exit;
        SetOpName(ntGr7Op[M]);
        SetCmdArg(A);
      end;
    2: begin
        SetOpName(hnLAR);
        if not readRMD(1) then Exit;
      end;
    3: begin
        SetOpName(hnLSL);
        if not readRMD(1) then Exit;
      end;
    4: SetOpName(hnLOADALL);
    5: SetOpName(hnCLTS);
    6: SetOpName(hnINVD);
    7: SetOpName(hnWBINVD);
    8: SetOpName(hnILLEGAL);
    9: begin
        if not ReadByte(B1) then Exit;
        case B1 and $C0 of
          $C0: begin
              C := (B1 and $38)shr 3;
              R := B1 and $7;
            end;
          else Exit;
        end;
        SetOpName(hnMOV);
        SetCmdArg(ntReg32[R]);
        SetCmdArg(ntCReg[C]);
      end;
    10: begin
        if not ReadByte(B1) then Exit;
        case B1 and $C0 of
          $C0: begin
              C := (B1 and $38)shr 3;
              R := B1 and $7;
            end;
          else Exit;
        end;
        SetOpName(hnMOV);
        SetCmdArg(ntReg32[R]);
        SetCmdArg(ntDReg[C]);
      end;
    11: begin
        if not ReadByte(B1) then Exit;
        case B1 and $C0 of
          $C0: begin
              C := (B1 and $38)shr 3;
              R := B1 and $7;
            end;
          else Exit;
        end;
        SetOpName(hnMOV);
        SetCmdArg(ntCReg[C]);
        SetCmdArg(ntReg32[R]);
      end;
    12: begin
        if not ReadByte(B1) then Exit;
        case B1 and $C0 of
          $C0: begin
              C := (B1 and $38)shr 3;
              R := B1 and $7;
            end;
          else Exit;
        end;
        SetOpName(hnMOV);
        SetCmdArg(ntDReg[C]);
        SetCmdArg(ntReg32[R]);
      end;
    13: begin
        if not ReadByte(B1) then Exit;
        case B1 and $C0 of
          $C0: begin
              C := (B1 and $38)shr 3;
              R := B1 and $7;
            end;
          else Exit;
        end;
        SetOpName(hnMOV);
        SetCmdArg(ntReg32[R]);
        SetCmdArg(ntTReg[C]);
      end;
    14: begin
        if not ReadByte(B1) then Exit;
        case B1 and $C0 of
          $C0: begin
              C := (B1 and $38)shr 3;
              R := B1 and $7;
            end;
          else Exit;
        end;
        SetOpName(hnMOV);
        SetCmdArg(ntTReg[C]);
        SetCmdArg(ntReg32[R]);
      end;
    15: SetOpName(hnWRMSR);
    16: SetOpName(hnRDTSC);
    17: SetOpName(hnRDMSR);
    18: SetOpName(hnRDPMC);
    19: begin
        D := B0 and $F;
        SetOpName(hnCMOV_);
        SetCmdArg(ntJmpCond[D]);
        if not readRMD(1) then Exit;
      end;
    20: begin
        D := B0 and $F;
        SetOpName(hnJ_);
        SetCmdArg(ntJmpCond[D]);
        if not JmpOfsW then Exit;
      end;
    21: begin
        D := B0 and $F;
        SetOpName(hnSET_);
        SetCmdArg(ntJmpCond[D]);
        if not readEA(0,M) then Exit;
      end;
    22: begin
        SetOpName(hnPUSH);
        SetCmdArg(hnFS);
      end;
    23: begin
        SetOpName(hnPOP);
        SetCmdArg(hnFS);
      end;
    24: SetOpName(hnCPUID);
    25: begin
        SetOpName(hnBT);
        if not readRMD(1) then Exit;
      end;
    26: begin
        SetOpName(hnSHLD);
        if not readRMR(1) then Exit;
        if not ImmedBW(0) then Exit;
      end;
    27: begin
        SetOpName(hnSHLD);
        if not readRMR(1) then Exit;
        SetCmdArg(hnCL);
      end;
    28: begin
        D := B0 and $1;
        SetOpName(hnCMPXCHG);
        if not readRMD(D) then Exit;
      end;
    29: begin
        SetOpName(hnPUSH);
        SetCmdArg(hnGS);
      end;
    30: begin
        SetOpName(hnPOP);
        SetCmdArg(hnGS);
      end;
    31: SetOpName(hnRSM);
    32: begin
        SetOpName(hnBTS);
        if not readRMR(1) then Exit;
      end;
    33: begin
        SetOpName(hnSHRD);
        if not readRMR(1) then Exit;
        if not ImmedBW(0) then Exit;
      end;
    34: begin
        SetOpName(hnSHRD);
        if not readRMR(1) then Exit;
        SetCmdArg(hnCL);
      end;
    35: begin
        SetOpName(hnIMUL);
        if not readRMD(1) then Exit;
      end;
    36: begin
        SetOpName(hnLSS);
        if not ReadRMWD(2) then Exit;
      end;
    37: begin
        SetOpName(hnBTR);
        if not readRMR(1) then Exit;
      end;
    38: begin
        SetOpName(hnLFS);
        if not ReadRMWD(2) then Exit;
      end;
    39: begin
        SetOpName(hnLGS);
        if not ReadRMWD(2) then Exit;
      end;
    40: begin
        W := B0 and $1;
        SetOpName(hnMOVZX);
        if not ReadRMWD(W) then Exit;
      end;
    41: SetOpName(hnILLEG1);
    42: begin
        if not readEA(1,_1) then Exit;
        SetOpName(ntBtOp[_1]);
        if not ImmedBW(0) then Exit;
      end;
    43: begin
        SetOpName(hnBTC);
        if not readRMR(1) then Exit;
      end;
    44: begin
        SetOpName(hnBSF);
        if not readRMD(1) then Exit;
      end;
    45: begin
        SetOpName(hnBSR);
        if not readRMD(1) then Exit;
      end;
    46: begin
        W := B0 and $1;
        SetOpName(hnMOVSX);
        if not ReadRMWD(W) then Exit;
      end;
    47: begin
        W := B0 and $1;
        SetOpName(hnXADD);
        if not readRMD(W) then Exit;
      end;
    48: begin
        R := B0 and $7;
        SetOpName(hnBSWAP);
        if not RegW(R,_1) then Exit;
        SetCmdArg(_1);
      end;
    else SetOpName(hnQ);
  end;
  Result := true;
end ;

const
  ntFPReg: array[0..8-1]of THBMName = (
    hnST, hnST1, hnST2, hnST3, hnST4, hnST5, hnST6, hnST7
  );

const
  ntfops: array[0..8-1]of THBMName = (
    hnADD, hnMUL, hnCOM, hnCOMP, hnSUB, hnSUBR, hnDIV, hnDIVR
  );

const
  ntflsops: array[0..4-1]of THBMName = (
    hnLD, hnQ, hnST, hnSTP
  );

const
  ntfEsc1s: array[0..4-1]of THBMName = (
    hnFLDENV, hnFLDCW, hnFSTENV, hnFSTCW
  );

const
  ntfEsc1s1: array[0..4-1]of THBMName = (
    hnFLD, hnFXCH, hnFNOP, hnFSTP
  );

const
  ntfEsc1s2: array[0..32-1]of THBMName = (
    hnFCHS, hnFABS, hnQ, hnQ, hnFTST, hnFXAM, hnQ, hnQ, hnFLD1, hnFLDL2T, hnFLDL2E, hnFLDPI, hnFLDLG2, hnFLDLN2, hnFLDZ, hnQ, hnF2XM1, hnFYL2X, hnFPTAN, hnFPATAN, hnFXTRACT, hnFPREM, hnFDECSTP, hnFINCSTP, hnFPREM, hnFYL2XP1, hnFSQRT, hnFSINCOS, hnFRNDINT, hnFSCALE, hnFSIN, hnFCOS
  );

const
  ntfEsc3s: array[0..4-1]of THBMName = (
    hnQ, hnFLD, hnQ, hnFST
  );

const
  ntfEsc3s1: array[0..8-1]of THBMName = (
    hnFENI, hnFDISI, hnFCLEX, hnFINIT, hnFSETPM, hnQ, hnQ, hnQ
  );

const
  ntfEsc5s: array[0..4-1]of THBMName = (
    hnFSTOR, hnQ, hnFSAVE, hnFSTSW
  );

const
  ntfEsc5s1: array[0..8-1]of THBMName = (
    hnFFREE, hnQ, hnFST, hnFSTP, hnFUCOM, hnFUCOMP, hnQ, hnQ
  );

const
  ntfopEsc6s: array[0..8-1]of THBMName = (
    hnADD, hnMUL, hnQ, hnCOMP, hnSUBR, hnSUB, hnDIVR, hnDIV
  );

const
  ntfEsc7s: array[0..4-1]of THBMName = (
    hnFBLD, hnFILD, hnFBSTP, hnFISTP
  );

const
  ntfcond: array[0..4-1]of THBMName = (
    hnB, hnE, hnBE, hnU
  );

function PutSt(M: integer): boolean;
var
  Y: integer;
begin
  Result := false;
  case M and $6 of
    $2: begin
        Y := M and $1;
      end;
    else SetCmdArg(hnST);
  end;
  Result := true;
end ;

const
  ntFPType: array[0..2-1]of THBMName = (
    hnF, hnFI
  );

function SizeEven(C: integer): boolean;
var
  L: integer;
begin
  Result := false;
  if (C and $4)=$0 then begin
     L := C and $3;
     setEASize(3);
   end
  else if (C and $6)=$4 then begin
     L := C and $1;
     setEASize(4);
   end
  else if (C and $6)=$6 then begin
     L := C and $1;
     setEASize(2);
   end
  else
    Exit;
  Result := true;
end ;

function readFP(B: integer): boolean;
var
  X,C,NextB,M,R,Y,A,T,N: integer;
begin
  Result := false;
  begin
    X := (B and $F8)shr 3;
    C := B and $7;
  end;
  if not ReadByte(NextB) then Exit;
  case NextB and $C0 of
    $C0: begin
        M := (NextB and $38)shr 3;
        R := NextB and $7;
        case C and $F of
          $0: begin
              SetPrefix(hnF);
              SetOpName(ntfops[M]);
              if not PutSt(M) then Exit;
              SetCmdArg(ntFPReg[R]);
            end;
          $1: case NextB and $E0 of
              $E0: begin
                  Y := NextB and $1F;
                  SetOpName(ntfEsc1s2[Y]);
                end;
              else begin
                  SetOpName(ntfEsc1s1[M]);
                  SetCmdArg(ntFPReg[R]);
                end;
            end;
          $2: if (NextB and $E0)=$C0 then begin
               Y := (NextB and $18)shr 3;
               R := NextB and $7;
               SetOpName(hnFCMOV_);
               SetCmdArg(ntfcond[Y]);
               SetCmdArg(hnST);
               SetCmdArg(ntFPReg[R]);
             end
            else if (NextB and $F8)=$E8 then begin
               Y := NextB and $7;
               SetOpName(hnFUCOMPP);
             end
            else 
              Exit;
          $3: if (NextB and $E0)=$C0 then begin
               Y := (NextB and $18)shr 3;
               R := NextB and $7;
               SetOpName(hnFCMOVN_);
               SetCmdArg(ntfcond[Y]);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -