Ignore:
Timestamp:
Nov 22, 2023, 11:37:44 PM (6 months ago)
Author:
chronos
Message:
  • Fixed: Assembler to parse correctly register names and numeric values.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/ByteArray/Cpu.pas

    r55 r56  
    8888    procedure InstructionDec;
    8989    procedure InstructionDecSize;
     90    procedure InstructionXor;
     91    procedure InstructionXorSize;
     92    procedure InstructionAnd;
     93    procedure InstructionAndSize;
     94    procedure InstructionOr;
     95    procedure InstructionOrSize;
    9096    procedure InitInstructions;
    9197    procedure SetRunning(AValue: Boolean);
     
    469475  RegIndex := ReadRegIndex;
    470476  Regs[RegIndex] := Regs[RegIndex].Copy(DataSize) - 1;
     477end;
     478
     479procedure TCpu.InstructionXor;
     480var
     481  RegIndex: TRegIndex;
     482  RegIndex2: TRegIndex;
     483begin
     484  RegIndex := ReadRegIndex;
     485  RegIndex2 := ReadRegIndex;
     486  Regs[RegIndex] := Regs[RegIndex] xor Regs[RegIndex2];
     487end;
     488
     489procedure TCpu.InstructionXorSize;
     490var
     491  DataSize: TBigIntSize;
     492  RegIndex: TRegIndex;
     493  RegIndex2: TRegIndex;
     494begin
     495  DataSize := ReadSize;
     496  RegIndex := ReadRegIndex;
     497  RegIndex2 := ReadRegIndex;
     498  Regs[RegIndex] := Regs[RegIndex].Copy(DataSize) xor Regs[RegIndex2].Copy(DataSize);
     499end;
     500
     501procedure TCpu.InstructionAnd;
     502var
     503  RegIndex: TRegIndex;
     504  RegIndex2: TRegIndex;
     505begin
     506  RegIndex := ReadRegIndex;
     507  RegIndex2 := ReadRegIndex;
     508  Regs[RegIndex] := Regs[RegIndex] and Regs[RegIndex2];
     509end;
     510
     511procedure TCpu.InstructionAndSize;
     512var
     513  DataSize: TBigIntSize;
     514  RegIndex: TRegIndex;
     515  RegIndex2: TRegIndex;
     516begin
     517  DataSize := ReadSize;
     518  RegIndex := ReadRegIndex;
     519  RegIndex2 := ReadRegIndex;
     520  Regs[RegIndex] := Regs[RegIndex].Copy(DataSize) and Regs[RegIndex2].Copy(DataSize);
     521end;
     522
     523procedure TCpu.InstructionOr;
     524var
     525  RegIndex: TRegIndex;
     526  RegIndex2: TRegIndex;
     527begin
     528  RegIndex := ReadRegIndex;
     529  RegIndex2 := ReadRegIndex;
     530  Regs[RegIndex] := Regs[RegIndex] or Regs[RegIndex2];
     531end;
     532
     533procedure TCpu.InstructionOrSize;
     534var
     535  DataSize: TBigIntSize;
     536  RegIndex: TRegIndex;
     537  RegIndex2: TRegIndex;
     538begin
     539  DataSize := ReadSize;
     540  RegIndex := ReadRegIndex;
     541  RegIndex2 := ReadRegIndex;
     542  Regs[RegIndex] := Regs[RegIndex].Copy(DataSize) or Regs[RegIndex2].Copy(DataSize);
    471543end;
    472544
     
    507579  FInstructions[inDec] := InstructionDec;
    508580  FInstructions[inDecSize] := InstructionDecSize;
     581  FInstructions[inXor] := InstructionXor;
     582  FInstructions[inXorSize] := InstructionXorSize;
     583  FInstructions[inAnd] := InstructionAnd;
     584  FInstructions[inAndSize] := InstructionAndSize;
     585  FInstructions[inOr] := InstructionOr;
     586  FInstructions[inOrSize] := InstructionOrSize;
    509587end;
    510588
Note: See TracChangeset for help on using the changeset viewer.