Changeset 9 for branches/ByteArray/Core.pas
- Timestamp:
- Aug 6, 2024, 10:31:16 PM (2 months ago)
- Location:
- branches/ByteArray
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/ByteArray
-
Property svn:ignore
set to
lib
heaptrclog.trc
ByteArray
ByteArray.dbg
ByteArray.lps
ByteArray.res
-
Property svn:ignore
set to
-
branches/ByteArray/Core.pas
r5 r9 45 45 procedure DataModuleDestroy(Sender: TObject); 46 46 private 47 procedure InitMachine;48 47 procedure LoadConfig; 49 48 procedure SaveConfig; … … 59 58 StartUpForm: string; 60 59 AutoStartMachine: Boolean; 60 ExecutableFileName: string; 61 61 Machine: TMachine; 62 62 end; … … 78 78 begin 79 79 Machine := TMachine.Create; 80 //InitMachine;81 80 LoadConfig; 82 81 … … 94 93 ADebugger.Execute; 95 94 end; 95 if FileExists(ExecutableFileName) then 96 Machine.Memory.LoadFromFile(ExecutableFileName); 96 97 if AutoStartMachine then 97 98 Machine.PowerOn; … … 213 214 214 215 FreeAndNil(Machine); 215 end;216 217 procedure TCore.InitMachine;218 var219 Loop: TBigInt;220 begin221 with Machine.Cpu do begin222 Reset;223 224 // LD A, 'A'225 WriteInstruction(inLoadConst);226 WriteRegister(0);227 Write(DataWidth, Ord('A'));228 229 // LD B, 8230 WriteInstruction(inLoadConst);231 WriteRegister(1);232 Write(DataWidth, Machine.Serial.BaseAddress);233 234 // OUT (B), A235 WriteInstruction(inOutput);236 WriteRegister(1);237 WriteRegister(0);238 239 // LD B,240 WriteInstruction(inLoadConst);241 WriteRegister(1);242 Write(DataWidth, Machine.FrameBuffer.BaseAddress);243 244 WriteInstruction(inLoadConst);245 WriteRegister(2);246 Write(DataWidth, 10);247 248 Loop := PC;249 250 WriteInstruction(inOutput);251 WriteRegister(1);252 WriteRegister(0);253 254 WriteInstruction(inInc);255 WriteRegister(0);256 257 WriteInstruction(inDec);258 WriteRegister(2);259 260 WriteInstruction(inJumpNotZero);261 WriteRegister(2);262 Write(AddressWidth, Loop);263 264 WriteInstruction(inHalt);265 end;266 216 end; 267 217 … … 281 231 StartUpForm := ReadStringWithDefault('StartUpForm', 'Screen'); 282 232 AutoStartMachine := ReadBoolWithDefault('AutoStartMachine', True); 233 ExecutableFileName := ReadStringWithDefault('ExecutableFileName', 'compiled.bin'); 283 234 finally 284 235 Free; … … 299 250 WriteString('StartUpForm', StartUpForm); 300 251 WriteBool('AutoStartMachine', AutoStartMachine); 252 WriteString('ExecutableFileName', ExecutableFileName); 301 253 finally 302 254 Free;
Note:
See TracChangeset
for help on using the changeset viewer.