Ignore:
Timestamp:
Apr 25, 2019, 4:20:43 PM (6 years ago)
Author:
chronos
Message:
  • Added: Basic assembler window.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/virtualcpu4/UDisassembler.pas

    r183 r184  
    66
    77uses
    8   Classes, SysUtils, UMemory, fgl, UCpu, UInstructionReader, Math;
     8  Classes, SysUtils, UMemory, fgl, UCpu, UInstructionReader, Math, UOpcode;
    99
    1010type
     
    1919  TDisassembler = class(TInstructionReader)
    2020  private
     21    OpcodeDefs: TOpcodeDefs;
    2122  public
    2223    Output: TFPGObjectList<TDisassemblerLine>;
     
    4849  AddressRel: TAddressSigned;
    4950  Reg: TRegIndex;
     51  OpcodeDef: TOpcodeDef;
    5052begin
    5153  Init;
     
    5759    Opcode := Read8;
    5860    if Opcode <= Integer(High(TOpcode)) then begin
    59       Prefix := OpcodeDef[TOpcode(Opcode)].Prefix;
     61      OpcodeDef := OpcodeDefs.SearchByOpcode(TOpcode(Opcode));
     62      Prefix := OpcodeDef.Prefix;
    6063      case TOpcode(Opcode) of
    6164        opDataPrefix8: DataSize := bw8;
     
    7174      Line.Address := IP - 1;
    7275      Line.Opcode := IntToHex(Opcode, 2);
    73       Line.Instruction := OpcodeDef[TOpcode(Opcode)].Name;
    74       case OpcodeDef[TOpcode(Opcode)].Param1 of
     76      Line.Instruction := OpcodeDef.Name;
     77      case OpcodeDef.Param1 of
    7578        prReg: begin
    7679          Reg := Read8;
     
    9497        end;
    9598      end;
    96       case OpcodeDef[TOpcode(Opcode)].Param2 of
     99      case OpcodeDef.Param2 of
    97100        prReg: begin
    98101          Reg := Read8;
     
    116119        end;
    117120      end;
    118       case OpcodeDef[TOpcode(Opcode)].Param3 of
     121      case OpcodeDef.Param3 of
    119122        prReg: begin
    120123          Reg := Read8;
     
    156159constructor TDisassembler.Create;
    157160begin
     161  OpcodeDefs := TOpcodeDefs.Create;
    158162  Output := TFPGObjectList<TDisassemblerLine>.Create;
    159163end;
     
    161165destructor TDisassembler.Destroy;
    162166begin
    163   Output.Free;
     167  FreeAndNil(Output);
     168  FreeAndNil(OpcodeDefs);
    164169  inherited Destroy;
    165170end;
Note: See TracChangeset for help on using the changeset viewer.