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 | |
---|
1 | unit UFormConsole;
|
---|
2 |
|
---|
3 | {$mode delphi}
|
---|
4 |
|
---|
5 | interface
|
---|
6 |
|
---|
7 | uses
|
---|
8 | Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls, ExtCtrls,
|
---|
9 | UMachine;
|
---|
10 |
|
---|
11 | type
|
---|
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 |
|
---|
26 | var
|
---|
27 | FormConsole: TFormConsole;
|
---|
28 |
|
---|
29 | implementation
|
---|
30 |
|
---|
31 | {$R *.lfm}
|
---|
32 |
|
---|
33 | { TFormConsole }
|
---|
34 |
|
---|
35 | procedure TFormConsole.Memo1KeyPress(Sender: TObject; var Key: char);
|
---|
36 | begin
|
---|
37 | Machine.LockInput.Acquire;
|
---|
38 | Machine.InputBuffer := Machine.InputBuffer + Key;
|
---|
39 | Machine.LockInput.Release;
|
---|
40 | end;
|
---|
41 |
|
---|
42 | procedure TFormConsole.Timer1Timer(Sender: TObject);
|
---|
43 | begin
|
---|
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;
|
---|
53 | end;
|
---|
54 |
|
---|
55 | end.
|
---|
56 |
|
---|
Note:
See
TracBrowser
for help on using the repository browser.