Changeset 41 for branches


Ignore:
Timestamp:
Aug 12, 2023, 5:46:27 PM (16 months ago)
Author:
chronos
Message:
  • Modified: Screen and console made as separate forms.
Location:
branches/simple
Files:
7 added
2 deleted
7 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;
  • branches/simple/DataBus.pas

    r40 r41  
    3939  end;
    4040
     41
    4142implementation
    4243
  • branches/simple/Machine.pas

    r40 r41  
    88type
    99
     10  { TMachine }
     11
     12  TMachine = class
     13  protected
     14    FPoweredOn: Boolean;
     15    procedure SetPoweredOn(AValue: Boolean); virtual;
     16  published
     17    property PoweredOn: Boolean read FPoweredOn write SetPoweredOn;
     18  end;
     19
    1020  { TMachine8 }
    1121
    12   TMachine8 = class
     22  TMachine8 = class(TMachine)
    1323  private
    1424    FPoweredOn: Boolean;
    15     procedure SetPoweredOn(AValue: Boolean);
     25    procedure SetPoweredOn(AValue: Boolean); override;
    1626  public
    1727    DeviceMapper: TDeviceMapper8;
     
    2232    constructor Create;
    2333    destructor Destroy; override;
    24     property PoweredOn: Boolean read FPoweredOn write SetPoweredOn;
    2534  end;
    2635
    2736  { TMachine16 }
    2837
    29   TMachine16 = class
     38  TMachine16 = class(TMachine)
    3039  private
    3140    FPoweredOn: Boolean;
    32     procedure SetPoweredOn(AValue: Boolean);
     41    procedure SetPoweredOn(AValue: Boolean); override;
    3342  public
    3443    DeviceMapper: TDeviceMapper16;
     
    3948    constructor Create;
    4049    destructor Destroy; override;
    41     property PoweredOn: Boolean read FPoweredOn write SetPoweredOn;
    4250  end;
    4351
    4452
    4553implementation
     54
     55{ TMachine }
     56
     57procedure TMachine.SetPoweredOn(AValue: Boolean);
     58begin
     59  if FPoweredOn=AValue then Exit;
     60  FPoweredOn:=AValue;
     61end;
    4662
    4763{ TMachine16 }
  • branches/simple/Screen.pas

    r40 r41  
    1414  private
    1515    FOnChange: TNotifyEvent;
     16    function ReadData8: Byte;
     17    function ReadAddr8: Byte;
     18    function ReadWidth8: Byte;
     19    function ReadHeight8: Byte;
    1620    procedure WriteData8(Data: Byte);
    17     function ReadData8: Byte;
    1821    procedure WriteAddr8(Data: Byte);
    19     function ReadAddr8: Byte;
    2022    procedure WriteWidth8(Data: Byte);
    21     function ReadWidth8: Byte;
    2223    procedure WriteHeight8(Data: Byte);
    23     function ReadHeight8: Byte;
    2424    procedure DoChange;
    2525    procedure UpdateMode;
     
    4040  private
    4141    FOnChange: TNotifyEvent;
     42    function ReadData8: Byte;
     43    function ReadData16: Word;
     44    function ReadAddr16: Word;
     45    function ReadWidth16: Word;
     46    function ReadHeight16: Word;
    4247    procedure WriteData8(Data: Byte);
    4348    procedure WriteData16(Data: Word);
    44     function ReadData8: Byte;
    45     function ReadData16: Word;
    4649    procedure WriteAddr16(Data: Word);
    47     function ReadAddr16: Word;
    4850    procedure WriteWidth16(Data: Word);
    49     function ReadWidth16: Word;
    5051    procedure WriteHeight16(Data: Word);
    51     function ReadHeight16: Word;
    5252    procedure DoChange;
    5353    procedure UpdateMode;
  • branches/simple/simple.lpi

    r40 r41  
    3535      </Unit>
    3636      <Unit>
    37         <Filename Value="FormMain.pas"/>
     37        <Filename Value="Forms/FormMain.pas"/>
    3838        <IsPartOfProject Value="True"/>
    3939        <ComponentName Value="FormMain"/>
     
    7373        <IsPartOfProject Value="True"/>
    7474      </Unit>
     75      <Unit>
     76        <Filename Value="Forms/FormScreen.pas"/>
     77        <IsPartOfProject Value="True"/>
     78        <ComponentName Value="FormScreen"/>
     79        <HasResources Value="True"/>
     80        <ResourceBaseClass Value="Form"/>
     81      </Unit>
     82      <Unit>
     83        <Filename Value="Forms/FormConsole.pas"/>
     84        <IsPartOfProject Value="True"/>
     85        <ComponentName Value="FormConsole"/>
     86        <HasResources Value="True"/>
     87        <ResourceBaseClass Value="Form"/>
     88      </Unit>
    7589    </Units>
    7690  </ProjectOptions>
     
    8296    <SearchPaths>
    8397      <IncludeFiles Value="$(ProjOutDir)"/>
     98      <OtherUnitFiles Value="Forms"/>
    8499      <UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/>
    85100    </SearchPaths>
  • branches/simple/simple.lpr

    r40 r41  
    1212  Interfaces, // this includes the LCL widgetset
    1313  Forms, FormMain, Cpu, Machine, DataBus, Memory, DeviceMapper, Device, Console,
    14   Screen;
     14  Screen, FormScreen, FormConsole;
    1515
    1616{$R *.res}
Note: See TracChangeset for help on using the changeset viewer.