Changeset 172 for branches/virtualcpu4
- Timestamp:
- Apr 10, 2019, 11:49:27 PM (6 years ago)
- Location:
- branches/virtualcpu4
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/virtualcpu4
- Property svn:ignore
-
old new 1 1 lib 2 2 virtucpu4.exe 3 virtucpu4 3 4 *.lps 4 5 *.res
-
- Property svn:ignore
-
branches/virtualcpu4/UFormMain.lfm
r171 r172 1 1 object FormMain: TFormMain 2 2 Left = 223 3 Height = 7903 Height = 948 4 4 Top = 54 5 Width = 1 4325 Width = 1718 6 6 Caption = 'VirtCpu4' 7 ClientHeight = 7908 ClientWidth = 1 4329 DesignTimePPI = 1 207 ClientHeight = 948 8 ClientWidth = 1718 9 DesignTimePPI = 144 10 10 OnCreate = FormCreate 11 11 OnDestroy = FormDestroy … … 13 13 LCLVersion = '2.0.0.4' 14 14 object ButtonStart: TButton 15 Left = 98416 Height = 3 117 Top = 818 Width = 9415 Left = 1181 16 Height = 37 17 Top = 10 18 Width = 113 19 19 Caption = 'Start' 20 20 OnClick = ButtonStartClick 21 ParentFont = False 21 22 TabOrder = 0 22 23 end 23 24 object ButtonStop: TButton 24 Left = 98425 Height = 3 126 Top = 4827 Width = 9425 Left = 1181 26 Height = 37 27 Top = 58 28 Width = 113 28 29 Caption = 'Stop' 29 30 OnClick = ButtonStopClick 31 ParentFont = False 30 32 TabOrder = 1 31 33 end 32 34 object Label1: TLabel 33 Left = 98434 Height = 2 035 Top = 9636 Width = 3535 Left = 1181 36 Height = 26 37 Top = 115 38 Width = 48 37 39 Caption = 'Ticks:' 38 40 ParentColor = False 41 ParentFont = False 39 42 end 40 43 object ListViewRegisters: TListView 41 Left = 842 Height = 76943 Top = 844 Width = 3 1244 Left = 10 45 Height = 922 46 Top = 10 47 Width = 374 45 48 Anchors = [akTop, akLeft, akBottom] 46 49 Columns = < 47 50 item 48 51 Caption = 'Register' 49 Width = 1 0052 Width = 120 50 53 end 51 54 item 52 Width = 18055 Width = 239 53 56 end> 54 Font.Height = - 1757 Font.Height = -20 55 58 Font.Name = 'Liberation Mono' 56 59 OwnerData = True … … 61 64 end 62 65 object ListViewMemory: TListView 63 Left = 3 2864 Height = 76965 Top = 866 Width = 64866 Left = 394 67 Height = 922 68 Top = 10 69 Width = 778 67 70 Anchors = [akTop, akLeft, akBottom] 68 71 Columns = < 69 72 item 70 73 Caption = 'Address' 71 Width = 1 0074 Width = 120 72 75 end 73 76 item 74 Width = 50077 Width = 643 75 78 end> 76 Font.Height = - 1779 Font.Height = -20 77 80 Font.Name = 'Liberation Mono' 78 81 OwnerData = True … … 83 86 end 84 87 object Memo1: TMemo 85 Left = 98486 Height = 61987 Top = 1 6088 Width = 43288 Left = 1181 89 Height = 743 90 Top = 192 91 Width = 518 89 92 OnKeyPress = Memo1KeyPress 93 ParentFont = False 90 94 ReadOnly = True 91 95 TabOrder = 4 92 96 end 93 97 object Label2: TLabel 94 Left = 98495 Height = 2 096 Top = 1 3697 Width = 5698 Left = 1181 99 Height = 26 100 Top = 163 101 Width = 73 98 102 Caption = 'Console:' 99 103 ParentColor = False 104 ParentFont = False 100 105 end 101 106 object Timer1: TTimer 102 107 Interval = 200 103 108 OnTimer = Timer1Timer 104 left = 96105 top = 1 44109 left = 115 110 top = 173 106 111 end 107 112 end -
branches/virtualcpu4/UFormMain.pas
r171 r172 7 7 uses 8 8 Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls, ExtCtrls, 9 ComCtrls, UCpu, UInstructionWriter ;9 ComCtrls, UCpu, UInstructionWriter, syncobjs; 10 10 11 11 type … … 32 32 procedure Timer1Timer(Sender: TObject); 33 33 private 34 KeyInputBuffer: array of Char; 34 InputBuffer: string; 35 OutputBuffer: string; 36 Lock: TCriticalSection; 35 37 function CpuInput(Port: TAddress): TRegister; 36 38 procedure CpuOutput(Port: TAddress; Value: TRegister); … … 67 69 procedure TFormMain.FormCreate(Sender: TObject); 68 70 begin 71 Lock := TCriticalSection.Create; 69 72 Cpu := TCpu.Create; 70 73 Cpu.OnInput := CpuInput; … … 80 83 InstructionWriter.Free; 81 84 Cpu.Free; 85 Lock.Free; 82 86 end; 83 87 … … 120 124 procedure TFormMain.Memo1KeyPress(Sender: TObject; var Key: char); 121 125 begin 122 SetLength(KeyInputBuffer, Length(KeyInputBuffer) + 1); 123 KeyInputBuffer[High(KeyInputBuffer)] := Key; 126 Lock.Acquire; 127 InputBuffer := InputBuffer + Key; 128 Lock.Release; 124 129 end; 125 130 … … 129 134 ReloadMemoryDump; 130 135 ReloadRegisterDump; 136 Lock.Acquire; 137 Memo1.Lines.Text := Memo1.Lines.Text + OutputBuffer; 138 SetLength(OutputBuffer, 0); 139 Lock.Release; 131 140 end; 132 141 … … 186 195 case Port of 187 196 0: begin 188 while (Length(KeyInputBuffer) = 0) and not Cpu.Terminated do begin 197 Lock.Acquire; 198 while (Length(InputBuffer) = 0) and not Cpu.Terminated do begin 199 Lock.Release; 189 200 Sleep(100); 201 Lock.Acquire; 190 202 end; 191 if Length(KeyInputBuffer) > 0 then begin 192 Result.B := Ord(KeyInputBuffer[0]); 193 if Length(KeyInputBuffer) > 1 then 194 Move(KeyInputBuffer[1], KeyInputBuffer[0], Length(KeyInputBuffer) - 1); 195 SetLength(KeyInputBuffer, Length(KeyInputBuffer) - 1); 203 if Length(InputBuffer) > 0 then begin 204 Result.B := Ord(InputBuffer[1]); 205 Delete(InputBuffer, 1, 1); 196 206 end else Result.B := 0; 207 Lock.Release; 197 208 end; 198 209 end; … … 202 213 begin 203 214 case Port of 204 0: Memo1.Lines.Text := Memo1.Lines.Text + Char(Value.B); 215 0: begin 216 Lock.Acquire; 217 OutputBuffer := OutputBuffer + Char(Value.B); 218 Lock.Release; 219 end; 205 220 end; 206 221 end; -
branches/virtualcpu4/virtucpu4.lpi
r170 r172 16 16 <Icon Value="0"/> 17 17 </General> 18 <BuildModes Count="1"> 19 <Item1 Name="Default" Default="True"/> 18 <BuildModes Count="2"> 19 <Item1 Name="Debug" Default="True"/> 20 <Item2 Name="Release"> 21 <CompilerOptions> 22 <Version Value="11"/> 23 <PathDelim Value="\"/> 24 <Target> 25 <Filename Value="virtucpu4"/> 26 </Target> 27 <SearchPaths> 28 <IncludeFiles Value="$(ProjOutDir)"/> 29 <UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)-$(BuildMode)"/> 30 </SearchPaths> 31 <Parsing> 32 <SyntaxOptions> 33 <SyntaxMode Value="Delphi"/> 34 <CStyleOperator Value="False"/> 35 <AllowLabel Value="False"/> 36 <CPPInline Value="False"/> 37 </SyntaxOptions> 38 </Parsing> 39 <CodeGeneration> 40 <SmartLinkUnit Value="True"/> 41 <Optimizations> 42 <OptimizationLevel Value="3"/> 43 </Optimizations> 44 </CodeGeneration> 45 <Linking> 46 <Debugging> 47 <GenerateDebugInfo Value="False"/> 48 </Debugging> 49 <LinkSmart Value="True"/> 50 <Options> 51 <Win32> 52 <GraphicApplication Value="True"/> 53 </Win32> 54 </Options> 55 </Linking> 56 </CompilerOptions> 57 </Item2> 20 58 </BuildModes> 21 59 <PublishOptions> … … 62 100 <SearchPaths> 63 101 <IncludeFiles Value="$(ProjOutDir)"/> 64 <UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS) "/>102 <UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)-$(BuildMode)"/> 65 103 </SearchPaths> 104 <Parsing> 105 <SyntaxOptions> 106 <SyntaxMode Value="Delphi"/> 107 <CStyleOperator Value="False"/> 108 <IncludeAssertionCode Value="True"/> 109 <AllowLabel Value="False"/> 110 <CPPInline Value="False"/> 111 </SyntaxOptions> 112 </Parsing> 113 <CodeGeneration> 114 <Checks> 115 <IOChecks Value="True"/> 116 <RangeChecks Value="True"/> 117 <OverflowChecks Value="True"/> 118 <StackChecks Value="True"/> 119 </Checks> 120 <VerifyObjMethodCallValidity Value="True"/> 121 </CodeGeneration> 66 122 <Linking> 123 <Debugging> 124 <UseHeaptrc Value="True"/> 125 </Debugging> 67 126 <Options> 68 127 <Win32> -
branches/virtualcpu4/virtucpu4.lpr
r170 r172 4 4 5 5 uses 6 {$IFDEF UNIX} {$IFDEF UseCThreads}6 {$IFDEF UNIX} 7 7 cthreads, 8 {$ENDIF} {$ENDIF}8 {$ENDIF} 9 9 Interfaces, // this includes the LCL widgetset 10 10 Forms, UFormMain, UCpu
Note:
See TracChangeset
for help on using the changeset viewer.