Changeset 184 for branches/virtualcpu4/UDisassembler.pas
- Timestamp:
- Apr 25, 2019, 4:20:43 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/virtualcpu4/UDisassembler.pas
r183 r184 6 6 7 7 uses 8 Classes, SysUtils, UMemory, fgl, UCpu, UInstructionReader, Math ;8 Classes, SysUtils, UMemory, fgl, UCpu, UInstructionReader, Math, UOpcode; 9 9 10 10 type … … 19 19 TDisassembler = class(TInstructionReader) 20 20 private 21 OpcodeDefs: TOpcodeDefs; 21 22 public 22 23 Output: TFPGObjectList<TDisassemblerLine>; … … 48 49 AddressRel: TAddressSigned; 49 50 Reg: TRegIndex; 51 OpcodeDef: TOpcodeDef; 50 52 begin 51 53 Init; … … 57 59 Opcode := Read8; 58 60 if Opcode <= Integer(High(TOpcode)) then begin 59 Prefix := OpcodeDef[TOpcode(Opcode)].Prefix; 61 OpcodeDef := OpcodeDefs.SearchByOpcode(TOpcode(Opcode)); 62 Prefix := OpcodeDef.Prefix; 60 63 case TOpcode(Opcode) of 61 64 opDataPrefix8: DataSize := bw8; … … 71 74 Line.Address := IP - 1; 72 75 Line.Opcode := IntToHex(Opcode, 2); 73 Line.Instruction := OpcodeDef [TOpcode(Opcode)].Name;74 case OpcodeDef [TOpcode(Opcode)].Param1 of76 Line.Instruction := OpcodeDef.Name; 77 case OpcodeDef.Param1 of 75 78 prReg: begin 76 79 Reg := Read8; … … 94 97 end; 95 98 end; 96 case OpcodeDef [TOpcode(Opcode)].Param2 of99 case OpcodeDef.Param2 of 97 100 prReg: begin 98 101 Reg := Read8; … … 116 119 end; 117 120 end; 118 case OpcodeDef [TOpcode(Opcode)].Param3 of121 case OpcodeDef.Param3 of 119 122 prReg: begin 120 123 Reg := Read8; … … 156 159 constructor TDisassembler.Create; 157 160 begin 161 OpcodeDefs := TOpcodeDefs.Create; 158 162 Output := TFPGObjectList<TDisassemblerLine>.Create; 159 163 end; … … 161 165 destructor TDisassembler.Destroy; 162 166 begin 163 Output.Free; 167 FreeAndNil(Output); 168 FreeAndNil(OpcodeDefs); 164 169 inherited Destroy; 165 170 end;
Note:
See TracChangeset
for help on using the changeset viewer.