Changeset 8


Ignore:
Timestamp:
Aug 2, 2024, 9:36:35 AM (4 months ago)
Author:
chronos
Message:
  • Added: Common package.
  • Added: Memory form to show content of memory.
Location:
branches/bigint
Files:
82 added
8 edited
1 moved

Legend:

Unmodified
Added
Removed
  • branches/bigint

    • Property svn:ignore
      •  

        old new  
        44BigIntVM.dbg
        55lib
         6heaptrclog.trc
  • branches/bigint/Assembler.pas

    r7 r8  
    55uses
    66  Classes, SysUtils, Instructions, Cpu, Generics.Collections,
    7   Memory, Message, Parser, Int;
     7  IntMemory, Message, Parser, Int;
    88
    99type
     
    3232  public
    3333    InstructionSet: TInstructionSet;
    34     Memory: TMemory;
     34    Memory: TIntMemory;
    3535    Labels: TDictionary<string, TInt>;
    3636    LabelRefs: TList<TLabelRef>;
     
    286286  Parser.OnError := Error;
    287287  Message := TMessages.Create;
    288   Memory := TMemory.Create;
     288  Memory := TIntMemory.Create;
    289289  InstructionSet := TInstructionSet.Create;
    290290  Labels := TDictionary<string, TInt>.Create;
  • branches/bigint/BigIntVM.lpi

    r6 r8  
    2525            <IncludeFiles Value="$(ProjOutDir)"/>
    2626            <OtherUnitFiles Value="Forms"/>
    27             <UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)-$(BuildMode}"/>
     27            <UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)-$(BuildMode)"/>
    2828          </SearchPaths>
    2929          <Parsing>
     
    5959        </CompilerOptions>
    6060      </Item>
     61      <SharedMatrixOptions Count="2">
     62        <Item1 Targets="Common" Modes="Debug" Value="-g -gl -gh -CirotR -O1"/>
     63        <Item2 ID="202440807568" Targets="Common" Modes="Release" Value="-CX -XX -O3"/>
     64      </SharedMatrixOptions>
    6165    </BuildModes>
    6266    <PublishOptions>
     
    6973    <RequiredPackages>
    7074      <Item>
     75        <PackageName Value="Common"/>
     76        <DefaultFilename Value="Packages/Common/Common.lpk" Prefer="True"/>
     77      </Item>
     78      <Item>
    7179        <PackageName Value="LCL"/>
    7280      </Item>
     
    8997      </Unit>
    9098      <Unit>
    91         <Filename Value="Memory.pas"/>
     99        <Filename Value="IntMemory.pas"/>
    92100        <IsPartOfProject Value="True"/>
    93101      </Unit>
     
    145153        <ComponentName Value="FormDisassembler"/>
    146154        <ResourceBaseClass Value="Form"/>
     155      </Unit>
     156      <Unit>
     157        <Filename Value="Forms/FormMemory.pas"/>
     158        <IsPartOfProject Value="True"/>
     159        <ComponentName Value="FormMemory"/>
    147160      </Unit>
    148161    </Units>
     
    156169      <IncludeFiles Value="$(ProjOutDir)"/>
    157170      <OtherUnitFiles Value="Forms"/>
    158       <UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)-$(BuildMode}"/>
     171      <UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)-$(BuildMode)"/>
    159172    </SearchPaths>
    160173    <Parsing>
  • branches/bigint/BigIntVM.lpr

    r6 r8  
    33uses
    44  {$IFDEF UNIX}
    5   cthreads,
     5  cthreads, clocale,
    66  {$ENDIF}
    77  {$IFDEF HASAMIGA}
    88  athreads,
    99  {$ENDIF}
    10   Interfaces, // this includes the LCL widgetset
    11   Forms, FormMain, FormDisassembler, Cpu, Memory, Int, Machine, DeviceManager,
    12   Screen, Console, Device, Assembler, Instructions, Parser, Message,
    13   Disassembler
     10  Interfaces, SysUtils, // this includes the LCL widgetset
     11  Forms, FormMain, FormDisassembler, FormMemory, Cpu, IntMemory, Int, Machine,
     12  DeviceManager, Screen, Console, Device, Assembler, Instructions, Parser,
     13  Message, Disassembler, CommonPackage
    1414  { you can add units after this };
    1515
    1616{$R *.res}
    1717
     18{$if declared(UseHeapTrace)}
     19const
     20  HeapTraceLog = 'heaptrclog.trc';
     21{$ENDIF}
     22
    1823begin
     24  {$if declared(UseHeapTrace)}
     25  // Heap trace
     26  DeleteFile(ExtractFilePath(ParamStr(0)) + HeapTraceLog);
     27  SetHeapTraceOutput(ExtractFilePath(ParamStr(0)) + HeapTraceLog);
     28  {$ENDIF}
     29
    1930  RequireDerivedFormResource:=True;
    2031  Application.Scaled:=True;
  • branches/bigint/Disassembler.pas

    r7 r8  
    44
    55uses
    6   Classes, SysUtils, Cpu, Instructions, StrUtils, Memory, Int;
     6  Classes, SysUtils, Cpu, Instructions, StrUtils, IntMemory, Int;
    77
    88type
     
    1212  TDisassembler = class
    1313    InstructionSet: TInstructionSet;
    14     Memory: TMemory;
     14    Memory: TIntMemory;
    1515    procedure Disassemble(Lines: TStrings);
    1616    procedure SaveToFile(FileName: string);
  • branches/bigint/Forms/FormDisassembler.pas

    r6 r8  
    44
    55uses
    6   Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls, Disassembler;
     6  Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls, Disassembler,
     7  FormEx;
    78
    89type
     
    1011  { TFormDisassembler }
    1112
    12   TFormDisassembler = class(TForm)
     13  TFormDisassembler = class(TFormEx)
    1314    MemoCode: TMemo;
    1415    procedure FormClose(Sender: TObject; var CloseAction: TCloseAction);
  • branches/bigint/Forms/FormMain.pas

    r6 r8  
    44
    55uses
    6   Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls, Machine, Int,
    7   Cpu, Assembler, FormDisassembler;
     6  Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls, Machine,
     7  Assembler, FormDisassembler, FormEx, FormMemory;
    88
    99type
     
    1111  { TFormMain }
    1212
    13   TFormMain = class(TForm)
     13  TFormMain = class(TFormEx)
    1414    Memo1: TMemo;
    1515    procedure FormCreate(Sender: TObject);
     
    2020  public
    2121    SubFormDisassembler: TFormDisassembler;
     22    SubFormMemory: TFormMemory;
    2223    Machine: TMachine;
    2324  end;
     
    4142procedure TFormMain.FormDestroy(Sender: TObject);
    4243begin
     44  FreeAndNil(SubFormMemory);
     45  FreeAndNil(SubFormDisassembler);
    4346  FreeAndNil(Machine);
    4447end;
     
    6669  SubFormDisassembler.Disassembler.Memory := Machine.Memory;
    6770  SubFormDisassembler.Show;
     71
     72  SubFormMemory := TFormMemory.Create(nil);
     73  SubFormMemory.Memory := Machine.Memory;
     74  SubFormMemory.Show;
    6875end;
    6976
  • branches/bigint/IntMemory.pas

    r7 r8  
    1 unit Memory;
     1unit IntMemory;
    22
    33interface
     
    88type
    99
    10   { TMemory }
     10  { TIntMemory }
    1111
    12   TMemory = class
     12  TIntMemory = class
    1313  private
    1414    FData: array of TInt;
     
    2121    procedure WritePos(Data: TInt);
    2222    function ReadPos: TInt;
    23     procedure CopyFrom(Source: TMemory; Dst, Src, Count: TInt);
     23    procedure CopyFrom(Source: TIntMemory; Dst, Src, Count: TInt);
    2424    procedure WriteStringPos(Value: string);
    2525    property Size: TInt read GetSize write SetSize;
     
    3131implementation
    3232
    33 { TMemory }
     33{ TIntMemory }
    3434
    35 function TMemory.GetSize: TInt;
     35function TIntMemory.GetSize: TInt;
    3636begin
    3737  Result := Length(FData);
    3838end;
    3939
    40 procedure TMemory.SetSize(AValue: TInt);
     40procedure TIntMemory.SetSize(AValue: TInt);
    4141begin
    4242  SetLength(FData, AValue);
    4343end;
    4444
    45 procedure TMemory.Write(Address, Data: TInt);
     45procedure TIntMemory.Write(Address, Data: TInt);
    4646begin
    4747  FData[Address] := Data;
    4848end;
    4949
    50 function TMemory.Read(Address: TInt): TInt;
     50function TIntMemory.Read(Address: TInt): TInt;
    5151begin
    5252  Result := FData[Address];
    5353end;
    5454
    55 procedure TMemory.WritePos(Data: TInt);
     55procedure TIntMemory.WritePos(Data: TInt);
    5656begin
    5757  Write(FPosition, Data);
     
    5959end;
    6060
    61 function TMemory.ReadPos: TInt;
     61function TIntMemory.ReadPos: TInt;
    6262begin
    6363  Result := Read(FPosition);
     
    6565end;
    6666
    67 procedure TMemory.CopyFrom(Source: TMemory; Dst, Src, Count: TInt);
     67procedure TIntMemory.CopyFrom(Source: TIntMemory; Dst, Src, Count: TInt);
    6868var
    6969  I: Integer;
     
    7676end;
    7777
    78 procedure TMemory.WriteStringPos(Value: string);
     78procedure TIntMemory.WriteStringPos(Value: string);
    7979var
    8080  I: Integer;
  • branches/bigint/Machine.pas

    r2 r8  
    44
    55uses
    6   Classes, SysUtils, Cpu, Memory, Console, DeviceManager;
     6  Classes, SysUtils, Cpu, IntMemory, Console, DeviceManager;
    77
    88type
     
    1212  TMachine = class
    1313    Cpu: TCpu;
    14     Memory: TMemory;
     14    Memory: TIntMemory;
    1515    Console: TConsole;
    1616    DeviceManager: TDeviceManager;
     
    2626constructor TMachine.Create;
    2727begin
    28   Memory := TMemory.Create;
     28  Memory := TIntMemory.Create;
    2929  Memory.Size := 10000;
    3030  Console := TConsole.Create;
Note: See TracChangeset for help on using the changeset viewer.