Changeset 180
- Timestamp:
- Apr 12, 2019, 10:48:02 PM (6 years ago)
- Location:
- branches/virtualcpu4
- Files:
-
- 14 added
- 2 deleted
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/virtualcpu4/UCpu.pas
r178 r180 136 136 const 137 137 BitWidthBytes: array[TBitWidth] of Byte = (0, 1, 2, 4, 8); 138 BitWidthText: array[TBitWidth] of string = ('None', '8-bit', '16-bit', '32-bit', '64-bit'); 138 139 139 140 implementation -
branches/virtualcpu4/UInstructionWriter.pas
r179 r180 1 1 unit UInstructionWriter; 2 2 3 {$mode objfpc}{$H+}3 {$mode delphi}{$H+} 4 4 5 5 interface 6 6 7 7 uses 8 Classes, SysUtils, UCpu ;8 Classes, SysUtils, UCpu, UMemory, fgl; 9 9 10 10 type … … 72 72 end; 73 73 74 TDisassemblerLine = class 75 Address: Integer; 76 Opcode: string; 77 Instruction: string; 78 end; 79 80 { TDisassembler } 81 74 82 TDisassembler = class 75 83 Memory: TMemoryPos; 84 Output: TFPGObjectList<TDisassemblerLine>; 85 procedure Process; 86 constructor Create; 87 destructor Destroy; override; 76 88 end; 77 89 … … 85 97 implementation 86 98 99 { TDisassembler } 100 101 procedure TDisassembler.Process; 102 var 103 Opcode: Byte; 104 Line: TDisassemblerLine; 105 begin 106 Output.Clear; 107 Memory.Position := Memory.Data; 108 109 while Memory.Position < Memory.Data + Memory.Size do begin 110 Opcode := Memory.ReadByte; 111 if Opcode < Integer(High(TOpcode)) then begin 112 Line := TDisassemblerLine.Create; 113 Line.Address := Memory.Position - Memory.Data; 114 Line.Opcode := IntToHex(Opcode, 2); 115 Line.Instruction := OpcodeName[TOpcode(Opcode)]; 116 Output.Add(Line); 117 end; 118 end; 119 end; 120 121 constructor TDisassembler.Create; 122 begin 123 Output := TFPGObjectList<TDisassemblerLine>.Create; 124 Memory := TMemoryPos.Create; 125 end; 126 127 destructor TDisassembler.Destroy; 128 begin 129 Memory.Free; 130 Output.Free; 131 inherited Destroy; 132 end; 133 87 134 { TAssembler } 88 135 -
branches/virtualcpu4/virtucpu4.lpi
r174 r180 27 27 <SearchPaths> 28 28 <IncludeFiles Value="$(ProjOutDir)"/> 29 <OtherUnitFiles Value="Forms"/> 29 30 <UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)-$(BuildMode)"/> 30 31 </SearchPaths> … … 70 71 </Item1> 71 72 </RequiredPackages> 72 <Units Count=" 5">73 <Units Count="11"> 73 74 <Unit0> 74 75 <Filename Value="virtucpu4.lpr"/> … … 76 77 </Unit0> 77 78 <Unit1> 78 <Filename Value=" UFormMain.pas"/>79 <Filename Value="Forms\UFormMain.pas"/> 79 80 <IsPartOfProject Value="True"/> 80 81 <ComponentName Value="FormMain"/> … … 94 95 <IsPartOfProject Value="True"/> 95 96 </Unit4> 97 <Unit5> 98 <Filename Value="UMemory.pas"/> 99 <IsPartOfProject Value="True"/> 100 </Unit5> 101 <Unit6> 102 <Filename Value="Forms\UFormDisassembler.pas"/> 103 <IsPartOfProject Value="True"/> 104 <ComponentName Value="FormDisassembler"/> 105 <ResourceBaseClass Value="Form"/> 106 </Unit6> 107 <Unit7> 108 <Filename Value="Forms\UFormMemory.pas"/> 109 <IsPartOfProject Value="True"/> 110 <ComponentName Value="FormMemory"/> 111 <ResourceBaseClass Value="Form"/> 112 </Unit7> 113 <Unit8> 114 <Filename Value="Forms\UFormCpuState.pas"/> 115 <IsPartOfProject Value="True"/> 116 <ComponentName Value="FormCpuState"/> 117 <ResourceBaseClass Value="Form"/> 118 </Unit8> 119 <Unit9> 120 <Filename Value="Forms\UFormScreen.pas"/> 121 <IsPartOfProject Value="True"/> 122 <ComponentName Value="FormScreen"/> 123 <ResourceBaseClass Value="Form"/> 124 </Unit9> 125 <Unit10> 126 <Filename Value="Forms\UFormConsole.pas"/> 127 <IsPartOfProject Value="True"/> 128 <ComponentName Value="FormConsole"/> 129 <ResourceBaseClass Value="Form"/> 130 </Unit10> 96 131 </Units> 97 132 </ProjectOptions> … … 104 139 <SearchPaths> 105 140 <IncludeFiles Value="$(ProjOutDir)"/> 141 <OtherUnitFiles Value="Forms"/> 106 142 <UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)-$(BuildMode)"/> 107 143 </SearchPaths> -
branches/virtualcpu4/virtucpu4.lpr
r176 r180 8 8 {$ENDIF} 9 9 Interfaces, // this includes the LCL widgetset 10 SysUtils, Forms, UFormMain, UCpu, UMachine 10 SysUtils, Forms, UFormMain, UCpu, UMachine, UMemory, UFormDisassembler, 11 UFormMemory, UFormCpuState, UFormScreen, UFormConsole 11 12 { you can add units after this }; 12 13
Note:
See TracChangeset
for help on using the changeset viewer.