source: branches/virtcpu varint/Forms/UFormConsole.pas

Last change on this file was 197, checked in by chronos, 5 years ago
  • Modified: All parts of virtual machine have own form in Forms subdirectory.
  • Modified: Main form moved to Forms subdirectory.
  • Modified: TCpu class moved to UCpu unit.
  • Added: Assembler and dissasembler forms.
File size: 989 bytes
Line 
1unit UFormConsole;
2
3{$mode delphi}
4
5interface
6
7uses
8 Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls, ExtCtrls,
9 UMachine;
10
11type
12
13 { TFormConsole }
14
15 TFormConsole = class(TForm)
16 Memo1: TMemo;
17 Timer1: TTimer;
18 procedure Memo1KeyPress(Sender: TObject; var Key: char);
19 procedure Timer1Timer(Sender: TObject);
20 private
21
22 public
23 Machine: TMachine;
24 end;
25
26var
27 FormConsole: TFormConsole;
28
29implementation
30
31{$R *.lfm}
32
33{ TFormConsole }
34
35procedure TFormConsole.Memo1KeyPress(Sender: TObject; var Key: char);
36begin
37 Machine.LockInput.Acquire;
38 Machine.InputBuffer := Machine.InputBuffer + Key;
39 Machine.LockInput.Release;
40end;
41
42procedure TFormConsole.Timer1Timer(Sender: TObject);
43begin
44 Machine.LockOutput.Acquire;
45 try
46 if Length(Machine.OutputBuffer) > 0 then begin
47 Memo1.Lines.Text := Memo1.Lines.Text + Machine.OutputBuffer;
48 SetLength(Machine.OutputBuffer, 0);
49 end;
50 finally
51 Machine.LockOutput.Release;
52 end;
53end;
54
55end.
56
Note: See TracBrowser for help on using the repository browser.