Changeset 175 for branches/virtualcpu4/UMachine.pas
- Timestamp:
- Apr 12, 2019, 1:34:47 AM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/virtualcpu4/UMachine.pas
r174 r175 11 11 TScreen = class 12 12 Size: TPoint; 13 MemoryBase: Integer; 13 14 end; 14 15 … … 19 20 function CpuInput(Port: TAddress): TRegister; 20 21 procedure CpuOutput(Port: TAddress; Value: TRegister); 22 function GetMemorySize: Integer; 23 procedure SetMemorySize(AValue: Integer); 21 24 public 22 Memory: array of Byte;25 Memory: Pointer; 23 26 Cpu: TCpu; 24 27 Screen: TScreen; … … 27 30 LockInput: TCriticalSection; 28 31 LockOutput: TCriticalSection; 32 property MemorySize: Integer read GetMemorySize write SetMemorySize; 29 33 constructor Create; 30 34 destructor Destroy; override; … … 42 46 Cpu.OnInput := CpuInput; 43 47 Cpu.OnOutput := CpuOutput; 44 Cpu.DataSize := bw 16;45 Cpu.AddressSize := bw 16;48 Cpu.DataSize := bw32; 49 Cpu.AddressSize := bw32; 46 50 Screen := TScreen.Create; 47 51 Screen.Size := Point(320, 240); 48 SetLength(Memory, 1000); 52 Screen.MemoryBase := $100; 53 MemorySize := $1000000; 49 54 Cpu.Memory := Memory; 50 55 end; … … 76 81 LockInput.Release; 77 82 end; 83 1: case Cpu.DataSize of 84 bw8: Result.B := Screen.Size.X; 85 bw16: Result.W := Screen.Size.X; 86 bw32: Result.D := Screen.Size.X; 87 bw64: Result.Q := Screen.Size.X; 88 end; 89 2: case Cpu.DataSize of 90 bw8: Result.B := Screen.Size.Y; 91 bw16: Result.W := Screen.Size.Y; 92 bw32: Result.D := Screen.Size.Y; 93 bw64: Result.Q := Screen.Size.Y; 94 end; 95 3: case Cpu.DataSize of 96 bw8: Result.B := Screen.MemoryBase; 97 bw16: Result.W := Screen.MemoryBase; 98 bw32: Result.D := Screen.MemoryBase; 99 bw64: Result.Q := Screen.MemoryBase; 100 end; 78 101 end; 79 102 end; … … 87 110 LockOutput.Release; 88 111 end; 112 1: case Cpu.DataSize of 113 bw8: Screen.Size.X := Value.B; 114 bw16: Screen.Size.X := Value.W; 115 bw32: Screen.Size.X := Value.D; 116 bw64: Screen.Size.X := Value.Q; 117 end; 118 2: case Cpu.DataSize of 119 bw8: Screen.Size.Y := Value.B; 120 bw16: Screen.Size.Y := Value.W; 121 bw32: Screen.Size.Y := Value.D; 122 bw64: Screen.Size.Y := Value.Q; 123 end; 124 3: case Cpu.DataSize of 125 bw8: Screen.MemoryBase := Value.B; 126 bw16: Screen.MemoryBase := Value.W; 127 bw32: Screen.MemoryBase := Value.D; 128 bw64: Screen.MemoryBase := Value.Q; 129 end; 89 130 end; 131 end; 132 133 function TMachine.GetMemorySize: Integer; 134 begin 135 Result := MemSize(Memory); 136 end; 137 138 procedure TMachine.SetMemorySize(AValue: Integer); 139 begin 140 Memory := ReAllocMem(Memory, AValue); 90 141 end; 91 142
Note:
See TracChangeset
for help on using the changeset viewer.