Changeset 5 for trunk/Memory.pas


Ignore:
Timestamp:
Apr 18, 2026, 7:24:02 PM (9 days ago)
Author:
chronos
Message:
  • Added: Some I/O ports handling.
  • Added: Messages form for capturing error messages.
  • Added: Go to address action.
  • Added: Allow to view all used memory areas in Memory window.
  • Added: Allow to reset CPU execution.
  • Modified: Improved memory mapping for MZ-700 and MZ-800 modes.
  • Fixed: Focusing currently executed instruction position.
  • Fixed: Wrong order or 8-bit registers in 16-bit pair.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Memory.pas

    r2 r5  
    44
    55uses
    6   Classes, SysUtils, Generics.Collections;
     6  Classes, SysUtils, Generics.Collections, Base;
    77
    88type
     
    1515    procedure SetSize(AValue: Integer); virtual;
    1616  public
     17    Title: string;
    1718    Position: Integer;
    1819    function Read(Address: Word): Byte; virtual;
     
    3435    procedure Write(Address: Word; Data: Byte); override;
    3536    procedure LoadFromFile(FileName: string); override;
     37  end;
     38
     39  { TMemoryIO }
     40
     41  TMemoryIO = class(TMemory)
     42  private
     43    FOnInput: TReadEvent;
     44    FOnOutput: TWriteEvent;
     45    FSize: Integer;
     46  public
     47    BasePort: Byte;
     48    function GetSize: Integer; override;
     49    procedure SetSize(AValue: Integer); override;
     50    function Read(Address: Word): Byte; override;
     51    procedure Write(Address: Word; Data: Byte); override;
     52    property OnInput: TReadEvent read FOnInput write FOnInput;
     53    property OnOutput: TWriteEvent read FOnOutput write FOnOutput;
    3654  end;
    3755
     
    166184end;
    167185
     186{ TMemoryIO }
     187
     188function TMemoryIO.GetSize: Integer;
     189begin
     190  Result := FSize;
     191end;
     192
     193procedure TMemoryIO.SetSize(AValue: Integer);
     194begin
     195  FSize := AVAlue;
     196end;
     197
     198function TMemoryIO.Read(Address: Word): Byte;
     199begin
     200  if Assigned(FOnInput) then FOnInput(BasePort + Address);
     201end;
     202
     203procedure TMemoryIO.Write(Address: Word; Data: Byte);
     204begin
     205  if Assigned(FOnOutput) then FOnOutput(BasePort + Address, Data);
     206end;
     207
    168208{ TMemory }
    169209
Note: See TracChangeset for help on using the changeset viewer.