source: branches/virtualcpu4/Forms/UFormScreen.pas

Last change on this file was 180, checked in by chronos, 6 years ago
  • Modified: Memory dump, CPU state, screen, console moved to separate forms.
  • Added: Dissasembler form.
File size: 1.6 KB
Line 
1unit UFormScreen;
2
3{$mode delphi}
4
5interface
6
7uses
8 Classes, SysUtils, Forms, Controls, Graphics, Dialogs, ExtCtrls, UMachine;
9
10type
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
28var
29 FormScreen: TFormScreen;
30
31implementation
32
33{$R *.lfm}
34
35{ TFormScreen }
36
37procedure TFormScreen.ScreenRepaing;
38var
39 B: Byte;
40 P: Integer;
41begin
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;
59end;
60
61procedure TFormScreen.Image1Resize(Sender: TObject);
62begin
63 Reload;
64 ScreenRepaing;
65end;
66
67procedure TFormScreen.FormShow(Sender: TObject);
68begin
69 Reload;
70 ScreenRepaing;
71end;
72
73procedure TFormScreen.Timer1Timer(Sender: TObject);
74begin
75 ScreenRepaing;
76end;
77
78procedure TFormScreen.Reload;
79begin
80 Machine.Screen.Size := Point(Image1.Width, Image1.Height);
81end;
82
83end.
84
Note: See TracBrowser for help on using the repository browser.