1 | unit UFormScreen;
|
---|
2 |
|
---|
3 | {$mode delphi}
|
---|
4 |
|
---|
5 | interface
|
---|
6 |
|
---|
7 | uses
|
---|
8 | Classes, SysUtils, Forms, Controls, Graphics, Dialogs, ExtCtrls, UMachine;
|
---|
9 |
|
---|
10 | type
|
---|
11 |
|
---|
12 | { TFormScreen }
|
---|
13 |
|
---|
14 | TFormScreen = class(TForm)
|
---|
15 | Image1: TImage;
|
---|
16 | Timer1: TTimer;
|
---|
17 | procedure FormShow(Sender: TObject);
|
---|
18 | procedure Image1Resize(Sender: TObject);
|
---|
19 | procedure Timer1Timer(Sender: TObject);
|
---|
20 | private
|
---|
21 | procedure ScreenRepaing;
|
---|
22 |
|
---|
23 | public
|
---|
24 | Machine: TMachine;
|
---|
25 | procedure Reload;
|
---|
26 | end;
|
---|
27 |
|
---|
28 | var
|
---|
29 | FormScreen: TFormScreen;
|
---|
30 |
|
---|
31 | implementation
|
---|
32 |
|
---|
33 | {$R *.lfm}
|
---|
34 |
|
---|
35 | { TFormScreen }
|
---|
36 |
|
---|
37 | procedure TFormScreen.ScreenRepaing;
|
---|
38 | var
|
---|
39 | B: Byte;
|
---|
40 | P: Integer;
|
---|
41 | begin
|
---|
42 | with Machine, Screen do begin
|
---|
43 | if ChangedAreaFrom < ChangedAreaTo then begin
|
---|
44 | if (Image1.Picture.Bitmap.Width <> Image1.Width) or
|
---|
45 | (Image1.Picture.Bitmap.Height <> Image1.Height) then
|
---|
46 | Image1.Picture.Bitmap.SetSize(Image1.Width, Image1.Height);
|
---|
47 | Image1.Picture.Bitmap.BeginUpdate(True);
|
---|
48 | P := ChangedAreaFrom;
|
---|
49 | while P <= ChangedAreaTo do begin
|
---|
50 | B := PByte(Memory + MemoryBase + P)^;
|
---|
51 | Image1.Canvas.Pixels[P mod Size.X, P div Size.X] := B * $010101;
|
---|
52 | Inc(P);
|
---|
53 | end;
|
---|
54 | ChangedAreaTo := MemoryBase;
|
---|
55 | ChangedAreaFrom := MemoryBase + MemorySize;
|
---|
56 | Image1.Picture.Bitmap.EndUpdate;
|
---|
57 | end;
|
---|
58 | end;
|
---|
59 | end;
|
---|
60 |
|
---|
61 | procedure TFormScreen.Image1Resize(Sender: TObject);
|
---|
62 | begin
|
---|
63 | Reload;
|
---|
64 | ScreenRepaing;
|
---|
65 | end;
|
---|
66 |
|
---|
67 | procedure TFormScreen.FormShow(Sender: TObject);
|
---|
68 | begin
|
---|
69 | Reload;
|
---|
70 | ScreenRepaing;
|
---|
71 | end;
|
---|
72 |
|
---|
73 | procedure TFormScreen.Timer1Timer(Sender: TObject);
|
---|
74 | begin
|
---|
75 | ScreenRepaing;
|
---|
76 | end;
|
---|
77 |
|
---|
78 | procedure TFormScreen.Reload;
|
---|
79 | begin
|
---|
80 | Machine.Screen.Size := Point(Image1.Width, Image1.Height);
|
---|
81 | end;
|
---|
82 |
|
---|
83 | end.
|
---|
84 |
|
---|