1 | unit UFormMain;
|
---|
2 |
|
---|
3 | {$mode objfpc}{$H+}
|
---|
4 |
|
---|
5 | interface
|
---|
6 |
|
---|
7 | uses
|
---|
8 | Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
|
---|
9 | UMachine, UInt128;
|
---|
10 |
|
---|
11 | type
|
---|
12 |
|
---|
13 | { TForm1 }
|
---|
14 |
|
---|
15 | TForm1 = class(TForm)
|
---|
16 | Memo1: TMemo;
|
---|
17 | procedure FormShow(Sender: TObject);
|
---|
18 | private
|
---|
19 |
|
---|
20 | public
|
---|
21 | end;
|
---|
22 |
|
---|
23 | var
|
---|
24 | Form1: TForm1;
|
---|
25 |
|
---|
26 |
|
---|
27 | implementation
|
---|
28 |
|
---|
29 | {$R *.lfm}
|
---|
30 |
|
---|
31 | { TForm1 }
|
---|
32 |
|
---|
33 | procedure TForm1.FormShow(Sender: TObject);
|
---|
34 | type
|
---|
35 | TCPU8 = specialize TCPU<ShortInt>;
|
---|
36 | TCPU16 = specialize TCPU<SmallInt>;
|
---|
37 | TCPU32 = specialize TCPU<Integer>;
|
---|
38 | TCPU64 = specialize TCPU<Int64>;
|
---|
39 | //TCPU128 = specialize TCPU<Int128>;
|
---|
40 | TInstWriter8 = specialize TInstructionWriter<ShortInt>;
|
---|
41 | TInstWriter16 = specialize TInstructionWriter<SmallInt>;
|
---|
42 | TInstWriter32 = specialize TInstructionWriter<Integer>;
|
---|
43 | TInstWriter64 = specialize TInstructionWriter<Int64>;
|
---|
44 | //TInstWriter128 = specialize TInstructionWriter<Int128>;
|
---|
45 | var
|
---|
46 | CPU8: TCPU8;
|
---|
47 | CPU16: TCPU16;
|
---|
48 | CPU32: TCPU32;
|
---|
49 | CPU64: TCPU64;
|
---|
50 | Writer8: TInstWriter8;
|
---|
51 | Writer16: TInstWriter16;
|
---|
52 | Writer32: TInstWriter32;
|
---|
53 | Writer64: TInstWriter64;
|
---|
54 | begin
|
---|
55 | { CPU8 := TCPU8.Create;
|
---|
56 | Writer8 := TInstWriter8.Create;
|
---|
57 | Writer8.Machine := CPU8;
|
---|
58 | Writer8.AddLoadConst(0, 1);
|
---|
59 | Writer8.AddHalt;
|
---|
60 | Writer8.Free;
|
---|
61 | CPU8.Run;
|
---|
62 | CPU8.Free;
|
---|
63 | }
|
---|
64 | CPU16 := TCPU16.Create;
|
---|
65 | Writer16 := TInstWriter16.Create;
|
---|
66 | Writer16.Machine := CPU16;
|
---|
67 | Writer16.AddLoadConst(0, 1);
|
---|
68 | Writer16.AddHalt;
|
---|
69 | Writer16.Free;
|
---|
70 | CPU16.Run;
|
---|
71 | CPU16.Free;
|
---|
72 |
|
---|
73 | CPU32 := TCPU32.Create;
|
---|
74 | Writer32 := TInstWriter32.Create;
|
---|
75 | Writer32.Machine := CPU32;
|
---|
76 | Writer32.AddLoadConst(0, 1);
|
---|
77 | Writer32.AddHalt;
|
---|
78 | Writer32.Free;
|
---|
79 | CPU32.Run;
|
---|
80 | CPU32.Free;
|
---|
81 |
|
---|
82 | CPU64 := TCPU64.Create;
|
---|
83 | Writer64 := TInstWriter64.Create;
|
---|
84 | Writer64.Machine := CPU64;
|
---|
85 | Writer64.AddLoadConst(0, 1);
|
---|
86 | Writer64.AddHalt;
|
---|
87 | Writer64.Free;
|
---|
88 | CPU64.Run;
|
---|
89 | CPU64.Free;
|
---|
90 | end;
|
---|
91 |
|
---|
92 | end.
|
---|
93 |
|
---|