Changeset 178 for branches/virtualcpu4


Ignore:
Timestamp:
Apr 12, 2019, 2:19:02 PM (6 years ago)
Author:
chronos
Message:
  • Added: Use more opcodes.
Location:
branches/virtualcpu4
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/virtualcpu4/UCpu.pas

    r177 r178  
    391391    end;
    392392    bw16: begin
    393       Registers[Read8].B := PWord(Memory + SP)^;
     393      Registers[Read8].W := PWord(Memory + SP)^;
    394394      Inc(SP, SizeOf(Word));
    395395    end;
    396396    bw32: begin
    397       Registers[Read8].B := PDWord(Memory + SP)^;
     397      Registers[Read8].D := PDWord(Memory + SP)^;
    398398      Inc(SP, SizeOf(DWord));
    399399    end;
    400400    bw64: begin
    401       Registers[Read8].B := PQWord(Memory + SP)^;
     401      Registers[Read8].Q := PQWord(Memory + SP)^;
    402402      Inc(SP, SizeOf(QWord));
    403403    end;
  • branches/virtualcpu4/UFormMain.pas

    r177 r178  
    222222
    223223    // Update screen area
     224    Push(R1);
    224225    Loadi(R1, 0);
    225226    Output(4, R1);
    226227    Loadi(R1, $10000);
    227228    Output(5, R1);
     229    Pop(R1);
    228230
    229231    // Read keyboard and print to console
  • branches/virtualcpu4/UInstructionWriter.pas

    r177 r178  
    4545    procedure JumpRelNotZero(Addr: QWord);
    4646    procedure JumpRelZero(Addr: QWord);
     47    procedure Push(Reg: TRegIndex);
     48    procedure Pop(Reg: TRegIndex);
    4749    procedure DataPrefix8;
    4850    procedure DataPrefix16;
     
    187189end;
    188190
     191procedure TInstructionWriter.Push(Reg: TRegIndex);
     192begin
     193  PrefixBegin;
     194  Write8(Byte(opPush));
     195  Write8(Reg);
     196  PrefixEnd;
     197end;
     198
     199procedure TInstructionWriter.Pop(Reg: TRegIndex);
     200begin
     201  PrefixBegin;
     202  Write8(Byte(opPop));
     203  Write8(Reg);
     204  PrefixEnd;
     205end;
     206
    189207procedure TInstructionWriter.DataPrefix8;
    190208begin
Note: See TracChangeset for help on using the changeset viewer.