Changeset 176 for branches/virtualcpu4/UFormMain.pas
- Timestamp:
- Apr 12, 2019, 11:43:24 AM (6 years ago)
- Location:
- branches/virtualcpu4
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/virtualcpu4
- Property svn:ignore
-
old new 4 4 *.lps 5 5 *.res 6 heaptrclog.trc
-
- Property svn:ignore
-
branches/virtualcpu4/UFormMain.pas
r175 r176 16 16 ButtonStart: TButton; 17 17 ButtonStop: TButton; 18 Image1: TImage; 18 19 Label1: TLabel; 19 20 Label2: TLabel; … … 21 22 ListViewRegisters: TListView; 22 23 Memo1: TMemo; 23 PaintBox1: TPaintBox;24 24 Timer1: TTimer; 25 25 TimerDraw: TTimer; … … 32 32 procedure ListViewRegistersData(Sender: TObject; Item: TListItem); 33 33 procedure Memo1KeyPress(Sender: TObject; var Key: char); 34 procedure PaintBox1Paint(Sender: TObject);34 procedure ScreenRepaing; 35 35 procedure PaintBox1Resize(Sender: TObject); 36 36 procedure Timer1Timer(Sender: TObject); … … 83 83 begin 84 84 LoadProgram; 85 PaintBox1Resize(Self); 85 86 end; 86 87 … … 123 124 end; 124 125 125 procedure TFormMain.PaintBox1Paint(Sender: TObject); 126 var 127 X, Y: Integer; 126 procedure TFormMain.ScreenRepaing; 127 var 128 128 B: Byte; 129 MemorySizeTmp: Integer; 130 Addr: Integer; 131 begin 132 MemorySizeTmp := Machine.MemorySize; 133 with Machine, Screen do 134 for Y := 0 to Size.Y - 1 do 135 for X := 0 to Size.X - 1 do begin 136 Addr := MemoryBase + Y * Size.X + X; 137 if Addr < MemorySizeTmp then begin 138 B := PByte(Memory + Addr)^; 139 PaintBox1.Canvas.Pixels[X, Y] := B * $010101; 129 P: Integer; 130 begin 131 with Machine, Screen do begin 132 if ChangedAreaFrom < ChangedAreaTo then begin 133 if (Image1.Picture.Bitmap.Width <> Image1.Width) or 134 (Image1.Picture.Bitmap.Height <> Image1.Height) then 135 Image1.Picture.Bitmap.SetSize(Image1.Width, Image1.Height); 136 Image1.Picture.Bitmap.BeginUpdate(True); 137 P := ChangedAreaFrom; 138 while P <= ChangedAreaTo do begin 139 B := PByte(Memory + MemoryBase + P)^; 140 Image1.Canvas.Pixels[P mod Size.X, P div Size.X] := B * $010101; 141 Inc(P); 142 end; 143 ChangedAreaTo := MemoryBase; 144 ChangedAreaFrom := MemoryBase + MemorySize; 145 Image1.Picture.Bitmap.EndUpdate; 140 146 end; 141 147 end; … … 144 150 procedure TFormMain.PaintBox1Resize(Sender: TObject); 145 151 begin 146 Machine.Screen.Size := Point( PaintBox1.Width, PaintBox1.Height);152 Machine.Screen.Size := Point(Image1.Width, Image1.Height); 147 153 end; 148 154 … … 160 166 procedure TFormMain.TimerDrawTimer(Sender: TObject); 161 167 begin 162 PaintBox1.Repaint;168 ScreenRepaing; 163 169 end; 164 170 … … 196 202 Loadi(R2, 12); 197 203 LabelPrint := IP; 198 204 DataPrefix8; LoadMem(R3, R1); 199 205 DataPrefix8; Output(0, R3); 200 206 Increment(R1); … … 213 219 Test(R2); 214 220 JumpNotZero(LabelClearScreen); 221 222 // Update screen area 223 Loadi(R1, 0); 224 Output(4, R1); 225 Loadi(R1, $10000); 226 Output(5, R1); 215 227 216 228 // Read keyboard and print to console
Note:
See TracChangeset
for help on using the changeset viewer.