source: branches/simple/Forms/FormScreen.pas

Last change on this file was 42, checked in by chronos, 15 months ago
  • Modified: Improved simple virtual machine.
File size: 1.6 KB
Line 
1unit FormScreen;
2
3interface
4
5uses
6 Classes, SysUtils, Forms, Controls, Graphics, Dialogs, ExtCtrls, Screen,
7 Channel, Device;
8
9type
10
11 { TFormScreen }
12
13 TFormScreen = class(TFormDevice)
14 Image1: TImage;
15 TimerDraw: TTimer;
16 procedure TimerDrawTimer(Sender: TObject);
17 private
18 DrawPending: Boolean;
19 public
20 Screen: TScreen;
21 procedure ScreenChange(Sender: TObject);
22 end;
23
24
25implementation
26
27{$R *.lfm}
28
29{ TFormScreen }
30
31procedure TFormScreen.TimerDrawTimer(Sender: TObject);
32var
33 X, Y: Integer;
34const
35 CharSize = 16;
36begin
37 if DrawPending then begin
38 DrawPending := False;
39 if Screen.BitWidth = bw8 then
40 with Screen.Screen8 do begin
41 Image1.Picture.Bitmap.SetSize(Width * CharSize, Height * CharSize);
42 Image1.Picture.Bitmap.Canvas.FillRect(0, 0, Image1.Picture.Bitmap.Width,
43 Image1.Picture.Bitmap.Height);
44 for Y := 0 to Height - 1 do
45 for X := 0 to Width - 1 do
46 Image1.Picture.Bitmap.Canvas.TextOut(X * CharSize, Y * CharSize,
47 Chr(Memory.Read8(Y * Width + X)));
48 end else
49 if Screen.BitWidth = bw16 then
50 with Screen.Screen16 do begin
51 Image1.Picture.Bitmap.SetSize(Width * CharSize, Height * CharSize);
52 Image1.Picture.Bitmap.Canvas.FillRect(0, 0, Image1.Picture.Bitmap.Width,
53 Image1.Picture.Bitmap.Height);
54 for Y := 0 to Height - 1 do
55 for X := 0 to Width - 1 do
56 Image1.Picture.Bitmap.Canvas.TextOut(X * CharSize, Y * CharSize,
57 Chr(Memory.Read8(Y * Width + X)));
58 end;
59 end;
60end;
61
62procedure TFormScreen.ScreenChange(Sender: TObject);
63begin
64 DrawPending := True;
65end;
66
67end.
68
Note: See TracBrowser for help on using the repository browser.