Subversion Repositories ht46f47_simulator

Rev

Rev 2 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2 Rev 3
Line 5... Line 5...
5
type
5
type
6
  Nibble = 0..15;
6
  Nibble = 0..15;
7
 
7
 
8
  TRom = array[0..$FF] of byte;
8
  TRom = array[0..$FF] of byte;
9
 
9
 
-
 
10
  TWaitEvent = procedure(milliseconds: integer) of object;
-
 
11
 
10
  THT46F47 = class(TObject)
12
  THT46F47 = class(TObject)
11
  strict private
13
  strict private
12
    procedure WaitMs(milliseconds: integer);
14
    procedure WaitMs(milliseconds: integer);
13
  strict protected
15
  strict protected
-
 
16
    FOnWait: TWaitEvent;
14
    // ROM
17
    // ROM
15
    // Registers
18
    // Registers
16
    FPC: byte;
19
    FPC: byte;
17
    FReturnAddress: byte;
20
    FReturnAddress: byte;
18
    FPage: Nibble;
21
    FPage: Nibble;
Line 50... Line 53...
50
    property AD2: Nibble read FAD2 write FAD2;
53
    property AD2: Nibble read FAD2 write FAD2;
51
    // Out
54
    // Out
52
    property PWM: Nibble read FPWM;
55
    property PWM: Nibble read FPWM;
53
    property PortOut: Nibble read FPortOut;
56
    property PortOut: Nibble read FPortOut;
54
    // Functions
57
    // Functions
-
 
58
    property OnWait: TWaitEvent read FOnWait write FOnWait;
55
    constructor Create;
59
    constructor Create;
56
    procedure Step;
60
    procedure Step;
57
    procedure Reset;
61
    procedure Reset;
58
  end;
62
  end;
59
 
63
 
Line 536... Line 540...
536
    FPC := ProgramCounterNext;
540
    FPC := ProgramCounterNext;
537
  end;
541
  end;
538
end;
542
end;
539
 
543
 
540
procedure THT46F47.WaitMs(milliseconds: integer);
544
procedure THT46F47.WaitMs(milliseconds: integer);
541
var
-
 
542
  i: integer;
-
 
543
begin
545
begin
-
 
546
  if Assigned(FOnWait) then
544
  for i := 0 to milliseconds div 10 do
547
    FOnWait(milliseconds)
545
  begin
548
  else
546
    Sleep(10);
549
    Sleep(milliseconds);
547
    Application.ProcessMessages;
-
 
548
    if Application.Terminated then break;
-
 
549
  end;
-
 
550
end;
550
end;
551
 
551
 
552
end.
552
end.