Ignore:
Timestamp:
Apr 13, 2019, 12:03:31 AM (6 years ago)
Author:
chronos
Message:
  • Added: Disassemble instruction.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/virtualcpu4/UCpu.pas

    r180 r181  
    134134  end;
    135135
     136  TOpcodeParam = (prNone, prReg, prData, prAddr, prAddrRel);
     137  TOpcodeDef = record
     138    Name: string;
     139    Param1: TOpcodeParam;
     140    Param2: TOpcodeParam;
     141    Param3: TOpcodeParam;
     142  end;
     143
    136144const
    137145  BitWidthBytes: array[TBitWidth] of Byte = (0, 1, 2, 4, 8);
    138146  BitWidthText: array[TBitWidth] of string = ('None', '8-bit', '16-bit', '32-bit', '64-bit');
     147  OpcodeDef: array[TOpcode] of TOpcodeDef = (
     148    (Name: 'NOP'; Param1: prNone; Param2: prNone; Param3: prNone),
     149    (Name: 'HALT'; Param1: prNone; Param2: prNone; Param3: prNone),
     150    (Name: 'LD'; Param1: prReg; Param2: prReg; Param3: prNone),
     151    (Name: 'LDI'; Param1: prReg; Param2: prData; Param3: prNone),
     152    (Name: 'JP'; Param1: prAddr; Param2: prNone; Param3: prNone),
     153    (Name: 'JPZ'; Param1: prAddr; Param2: prNone; Param3: prNone),
     154    (Name: 'JPNZ'; Param1: prAddr; Param2: prNone; Param3: prNone),
     155    (Name: 'JR'; Param1: prAddrRel; Param2: prNone; Param3: prNone),
     156    (Name: 'JRZ'; Param1: prAddrRel; Param2: prNone; Param3: prNone),
     157    (Name: 'JRNZ'; Param1: prAddrRel; Param2: prNone; Param3: prNone),
     158    (Name: 'NEG'; Param1: prReg; Param2: prNone; Param3: prNone),
     159    (Name: 'CLR'; Param1: prReg; Param2: prNone; Param3: prNone),
     160    (Name: 'LDM'; Param1: prReg; Param2: prReg; Param3: prNone),
     161    (Name: 'STM'; Param1: prReg; Param2: prReg; Param3: prNone),
     162    (Name: 'EX'; Param1: prReg; Param2: prReg; Param3: prNone),
     163    (Name: 'PUSH'; Param1: prReg; Param2: prNone; Param3: prNone),
     164    (Name: 'POP'; Param1: prReg; Param2: prNone; Param3: prNone),
     165    (Name: 'CALL'; Param1: prAddr; Param2: prNone; Param3: prNone),
     166    (Name: 'RET'; Param1: prNone; Param2: prNone; Param3: prNone),
     167    (Name: 'ADD'; Param1: prReg; Param2: prReg; Param3: prNone),
     168    (Name: 'ADDI'; Param1: prReg; Param2: prData; Param3: prNone),
     169    (Name: 'SUB'; Param1: prReg; Param2: prReg; Param3: prNone),
     170    (Name: 'SUBI'; Param1: prReg; Param2: prData; Param3: prNone),
     171    (Name: 'INC'; Param1: prReg; Param2: prNone; Param3: prNone),
     172    (Name: 'DEC'; Param1: prReg; Param2: prNone; Param3: prNone),
     173    (Name: 'IN'; Param1: prReg; Param2: prAddr; Param3: prNone),
     174    (Name: 'OUT'; Param1: prAddr; Param2: prReg; Param3: prNone),
     175    (Name: 'SHL'; Param1: prReg; Param2: prReg; Param3: prNone),
     176    (Name: 'SHR'; Param1: prReg; Param2: prReg; Param3: prNone),
     177    (Name: 'DP8'; Param1: prNone; Param2: prNone; Param3: prNone),
     178    (Name: 'DP16'; Param1: prNone; Param2: prNone; Param3: prNone),
     179    (Name: 'DP32'; Param1: prNone; Param2: prNone; Param3: prNone),
     180    (Name: 'DP64'; Param1: prNone; Param2: prNone; Param3: prNone),
     181    (Name: 'DS'; Param1: prNone; Param2: prNone; Param3: prNone),
     182    (Name: 'AS'; Param1: prNone; Param2: prNone; Param3: prNone),
     183    (Name: 'TEST'; Param1: prReg; Param2: prNone; Param3: prNone),
     184    (Name: 'AND'; Param1: prReg; Param2: prReg; Param3: prNone),
     185    (Name: 'OR'; Param1: prReg; Param2: prReg; Param3: prNone),
     186    (Name: 'XOR'; Param1: prReg; Param2: prReg; Param3: prNone),
     187    (Name: 'LDDR'; Param1: prReg; Param2: prReg; Param3: prReg),
     188    (Name: 'LDDR'; Param1: prReg; Param2: prReg; Param3: prReg),
     189    (Name: 'MUL'; Param1: prReg; Param2: prReg; Param3: prNone),
     190    (Name: 'DIV'; Param1: prReg; Param2: prReg; Param3: prNone),
     191    (Name: 'MOD'; Param1: prReg; Param2: prReg; Param3: prNone),
     192    (Name: 'AP8'; Param1: prNone; Param2: prNone; Param3: prNone),
     193    (Name: 'AP16'; Param1: prNone; Param2: prNone; Param3: prNone),
     194    (Name: 'AP32'; Param1: prNone; Param2: prNone; Param3: prNone),
     195    (Name: 'AP64'; Param1: prNone; Param2: prNone; Param3: prNone)
     196  );
    139197
    140198implementation
Note: See TracChangeset for help on using the changeset viewer.