Changeset 41 for branches/simple/Cpu.pas


Ignore:
Timestamp:
Aug 12, 2023, 5:46:27 PM (9 months ago)
Author:
chronos
Message:
  • Modified: Screen and console made as separate forms.
Location:
branches/simple
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/simple

    • Property svn:ignore set to
      lib
      simple
      simple.lps
      simple.res
  • branches/simple/Cpu.pas

    r40 r41  
    2121    A: Byte;
    2222    PC: Byte;
    23     function ReadPC8: Byte;
     23    function ReadProg8: Byte;
    2424    procedure Reset;
    2525    procedure Run;
     
    3737    A: Word;
    3838    PC: Word;
    39     function ReadPC8: Byte;
    40     function ReadPC16: Word;
     39    function ReadProg8: Byte;
     40    function ReadProg16: Word;
    4141    procedure Reset;
    4242    procedure Run;
     
    4949{ TCpu16 }
    5050
    51 function TCpu16.ReadPC8: Byte;
     51function TCpu16.ReadProg8: Byte;
    5252begin
    5353  Result := Memory.Read8(PC);
     
    5555end;
    5656
    57 function TCpu16.ReadPC16: Word;
     57function TCpu16.ReadProg16: Word;
    5858begin
    5959  Result := Memory.Read16(PC);
     
    7777  Instruction: TInstruction;
    7878begin
    79   Instruction := TInstruction(ReadPC8);
     79  Instruction := TInstruction(ReadProg8);
    8080  case Instruction of
    8181    inHalt: Terminated := True;
    82     inLoadImmediate8: A := ReadPC8;
    83     inLoadImmediate16: A := ReadPC16;
    84     inLoad8: A := Memory.Read8(ReadPC16);
    85     inLoad16: A := Memory.Read16(ReadPC16);
    86     inStore8: Memory.Write8(ReadPC16, A);
    87     inStore16: Memory.Write16(ReadPC16, A);
    88     inInput8: A := IO.Read8(ReadPC16);
    89     inInput16: A := IO.Read16(ReadPC16);
    90     inOutput8: IO.Write8(ReadPC16, A);
    91     inOutput16: IO.Write16(ReadPC16, A);
    92     inJump: PC := ReadPC16;
     82    inLoadImmediate8: A := ReadProg8;
     83    inLoadImmediate16: A := ReadProg16;
     84    inLoad8: A := Memory.Read8(ReadProg16);
     85    inLoad16: A := Memory.Read16(ReadProg16);
     86    inStore8: Memory.Write8(ReadProg16, A);
     87    inStore16: Memory.Write16(ReadProg16, A);
     88    inInput8: A := IO.Read8(ReadProg16);
     89    inInput16: A := IO.Read16(ReadProg16);
     90    inOutput8: IO.Write8(ReadProg16, A);
     91    inOutput16: IO.Write16(ReadProg16, A);
     92    inJump: PC := ReadProg16;
    9393  end;
    9494end;
     
    9696{ TCpu8 }
    9797
    98 function TCpu8.ReadPC8: Byte;
     98function TCpu8.ReadProg8: Byte;
    9999begin
    100100  Result := Memory.Read8(PC);
     
    118118  Instruction: TInstruction;
    119119begin
    120   Instruction := TInstruction(ReadPC8);
     120  Instruction := TInstruction(ReadProg8);
    121121  case Instruction of
    122     inLoadImmediate8: A := ReadPC8;
    123     inLoad8: A := Memory.Read8(ReadPC8);
    124     inStore8: Memory.Write8(ReadPC8, A);
    125     inInput8: A := IO.Read8(ReadPC8);
    126     inOutput8: IO.Write8(ReadPC8, A);
     122    inLoadImmediate8: A := ReadProg8;
     123    inLoad8: A := Memory.Read8(ReadProg8);
     124    inStore8: Memory.Write8(ReadProg8, A);
     125    inInput8: A := IO.Read8(ReadProg8);
     126    inOutput8: IO.Write8(ReadProg8, A);
    127127    inHalt: Terminated := True;
    128     inJump: PC := ReadPC8;
     128    inJump: PC := ReadProg8;
    129129  end;
    130130end;
Note: See TracChangeset for help on using the changeset viewer.