Changeset 57
- Timestamp:
- Nov 23, 2023, 10:42:57 PM (13 months ago)
- Location:
- branches/ByteArray
- Files:
-
- 9 added
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/ByteArray/ByteArray.lpi
r50 r57 227 227 <ResourceBaseClass Value="Form"/> 228 228 </Unit> 229 <Unit> 230 <Filename Value="Forms/FormSettings.pas"/> 231 <IsPartOfProject Value="True"/> 232 <ComponentName Value="FormSettings"/> 233 <HasResources Value="True"/> 234 <ResourceBaseClass Value="Form"/> 235 </Unit> 236 <Unit> 237 <Filename Value="Core.pas"/> 238 <IsPartOfProject Value="True"/> 239 <ComponentName Value="Core"/> 240 <ResourceBaseClass Value="DataModule"/> 241 </Unit> 242 <Unit> 243 <Filename Value="Forms/FormDebugger.pas"/> 244 <IsPartOfProject Value="True"/> 245 <ComponentName Value="FormDebugger"/> 246 <ResourceBaseClass Value="Form"/> 247 </Unit> 229 248 </Units> 230 249 </ProjectOptions> -
branches/ByteArray/ByteArray.lpr
r50 r57 1 1 program ByteArray; 2 3 {$mode objfpc}{$H+}4 2 5 3 uses 6 4 {$IFDEF UNIX} 7 cthreads, 5 cthreads, clocale, 8 6 {$ENDIF} 9 7 {$IFDEF HASAMIGA} … … 12 10 Interfaces, SysUtils,// this includes the LCL widgetset 13 11 Forms, FormMain, FormConsole, FormDevice, FormScreen, FormDisassembler, 14 FormAssembler, Cpu, BigInt, Channel, Common.Memory, FrameBuffer, Device, Storage, 15 DeviceMapper, Machine, Disassembler, Instructions, Parser, Message, Assembler, 16 Serial, Mouse, FormSourceEditor, FormMessages, FormMemory, FormStorage, Common 12 FormAssembler, Cpu, BigInt, Channel, Common.Memory, FrameBuffer, Device, 13 Storage, DeviceMapper, Machine, Disassembler, Instructions, Parser, Message, 14 Assembler, Serial, Mouse, FormSourceEditor, FormMessages, FormMemory, 15 FormStorage, Common, FormSettings, Core, FormDebugger 17 16 { you can add units after this }; 18 17 … … 34 33 Application.Scaled:=True; 35 34 Application.Initialize; 35 Application.CreateForm(TCore, Core.Core); 36 36 Application.CreateForm(TFormMain, FormMain.FormMain); 37 37 Application.Run; -
branches/ByteArray/Cpu.pas
r56 r57 94 94 procedure InstructionOr; 95 95 procedure InstructionOrSize; 96 procedure InstructionAdd; 97 procedure InstructionAddSize; 98 procedure InstructionSub; 99 procedure InstructionSubSize; 96 100 procedure InitInstructions; 97 101 procedure SetRunning(AValue: Boolean); … … 541 545 RegIndex2 := ReadRegIndex; 542 546 Regs[RegIndex] := Regs[RegIndex].Copy(DataSize) or Regs[RegIndex2].Copy(DataSize); 547 end; 548 549 procedure TCpu.InstructionAdd; 550 var 551 RegIndex: TRegIndex; 552 RegIndex2: TRegIndex; 553 begin 554 RegIndex := ReadRegIndex; 555 RegIndex2 := ReadRegIndex; 556 Regs[RegIndex] := Regs[RegIndex] + Regs[RegIndex2]; 557 end; 558 559 procedure TCpu.InstructionAddSize; 560 var 561 DataSize: TBigIntSize; 562 RegIndex: TRegIndex; 563 RegIndex2: TRegIndex; 564 begin 565 DataSize := ReadSize; 566 RegIndex := ReadRegIndex; 567 RegIndex2 := ReadRegIndex; 568 Regs[RegIndex] := Regs[RegIndex].Copy(DataSize) + Regs[RegIndex2].Copy(DataSize); 569 end; 570 571 procedure TCpu.InstructionSub; 572 var 573 RegIndex: TRegIndex; 574 RegIndex2: TRegIndex; 575 begin 576 RegIndex := ReadRegIndex; 577 RegIndex2 := ReadRegIndex; 578 Regs[RegIndex] := Regs[RegIndex] - Regs[RegIndex2]; 579 end; 580 581 procedure TCpu.InstructionSubSize; 582 var 583 DataSize: TBigIntSize; 584 RegIndex: TRegIndex; 585 RegIndex2: TRegIndex; 586 begin 587 DataSize := ReadSize; 588 RegIndex := ReadRegIndex; 589 RegIndex2 := ReadRegIndex; 590 Regs[RegIndex] := Regs[RegIndex].Copy(DataSize) + Regs[RegIndex2].Copy(DataSize); 543 591 end; 544 592 … … 585 633 FInstructions[inOr] := InstructionOr; 586 634 FInstructions[inOrSize] := InstructionOrSize; 635 FInstructions[inAdd] := InstructionAdd; 636 FInstructions[inAddSize] := InstructionAddSize; 637 FInstructions[inSub] := InstructionSub; 638 FInstructions[inSubSize] := InstructionSubSize; 587 639 end; 588 640 -
branches/ByteArray/Forms/FormMain.lfm
r50 r57 1 1 object FormMain: TFormMain 2 Left = 53 52 Left = 534 3 3 Height = 993 4 Top = 2 474 Top = 223 5 5 Width = 1491 6 6 Caption = 'ByteArray' … … 43 43 object MenuItem2: TMenuItem 44 44 Caption = 'Tools' 45 object MenuItem10: TMenuItem 46 Action = ASettings 47 end 48 object Separator2: TMenuItem 49 Caption = '-' 50 end 45 51 object MenuItem3: TMenuItem 46 52 Action = ASourceEditor … … 53 59 end 54 60 end 61 object MenuItem11: TMenuItem 62 Caption = 'Help' 63 object MenuItem12: TMenuItem 64 Action = AAbout 65 end 66 end 55 67 end 56 68 object ActionList1: TActionList 57 69 Left = 448 58 Top = 8070 Top = 79 59 71 object ASourceEditor: TAction 60 72 Caption = 'Source editor' … … 99 111 OnExecute = AConsoleExecute 100 112 end 101 end 102 object PersistentForm1: TPersistentForm 103 MinVisiblePart = 50 104 EntireVisible = False 105 Left = 640 106 Top = 79 113 object ASettings: TAction 114 Caption = 'Settings' 115 OnExecute = ASettingsExecute 116 end 117 object AAbout: TAction 118 Caption = 'About' 119 OnExecute = AAboutExecute 120 end 107 121 end 108 122 end -
branches/ByteArray/Forms/FormMain.lrj
r50 r57 4 4 {"hash":380871,"name":"tformmain.menuitem1.caption","sourcebytes":[86,105,101,119],"value":"View"}, 5 5 {"hash":5989939,"name":"tformmain.menuitem2.caption","sourcebytes":[84,111,111,108,115],"value":"Tools"}, 6 {"hash":322608,"name":"tformmain.menuitem11.caption","sourcebytes":[72,101,108,112],"value":"Help"}, 6 7 {"hash":215450690,"name":"tformmain.asourceeditor.caption","sourcebytes":[83,111,117,114,99,101,32,101,100,105,116,111,114],"value":"Source editor"}, 7 8 {"hash":194763106,"name":"tformmain.adebugger.caption","sourcebytes":[68,101,98,117,103,103,101,114],"value":"Debugger"}, … … 13 14 {"hash":179734405,"name":"tformmain.astorage.caption","sourcebytes":[83,116,111,114,97,103,101],"value":"Storage"}, 14 15 {"hash":94014398,"name":"tformmain.ascreen.caption","sourcebytes":[83,99,114,101,101,110],"value":"Screen"}, 15 {"hash":174433893,"name":"tformmain.aconsole.caption","sourcebytes":[67,111,110,115,111,108,101],"value":"Console"} 16 {"hash":174433893,"name":"tformmain.aconsole.caption","sourcebytes":[67,111,110,115,111,108,101],"value":"Console"}, 17 {"hash":213582195,"name":"tformmain.asettings.caption","sourcebytes":[83,101,116,116,105,110,103,115],"value":"Settings"}, 18 {"hash":4691652,"name":"tformmain.aabout.caption","sourcebytes":[65,98,111,117,116],"value":"About"} 16 19 ]} -
branches/ByteArray/Forms/FormMain.pas
r56 r57 5 5 uses 6 6 Classes, SysUtils, Forms, Controls, Graphics, Dialogs, Menus, ActnList, 7 FormConsole, FormScreen, Machine,Common.PersistentForm, FormSourceEditor,8 FormMemory, Common.FormEx, FormDisassembler, FormStorage ;7 FormConsole, FormScreen, Common.PersistentForm, FormSourceEditor, 8 FormMemory, Common.FormEx, FormDisassembler, FormStorage, FormDebugger; 9 9 10 10 type … … 14 14 TFormMain = class(TFormEx) 15 15 AConsole: TAction; 16 AAbout: TAction; 17 ASettings: TAction; 16 18 AScreen: TAction; 17 19 AStorage: TAction; … … 26 28 MainMenu1: TMainMenu; 27 29 MenuItem1: TMenuItem; 30 MenuItem10: TMenuItem; 31 MenuItem11: TMenuItem; 32 MenuItem12: TMenuItem; 33 Separator2: TMenuItem; 28 34 MenuItem2: TMenuItem; 29 35 MenuItem3: TMenuItem; … … 33 39 MenuItem7: TMenuItem; 34 40 MenuItem8: TMenuItem; 35 PersistentForm1: TPersistentForm;36 41 Separator1: TMenuItem; 37 42 MenuItem9: TMenuItem; … … 39 44 MenuItemViewStorage: TMenuItem; 40 45 MenuItemViewConsole: TMenuItem; 46 procedure AAboutExecute(Sender: TObject); 41 47 procedure AConsoleExecute(Sender: TObject); 42 48 procedure ADebuggerExecute(Sender: TObject); 43 49 procedure ADisassemblerExecute(Sender: TObject); 44 50 procedure AExitExecute(Sender: TObject); 51 procedure ASettingsExecute(Sender: TObject); 45 52 procedure AFullscreenExecute(Sender: TObject); 46 53 procedure AMemoryExecute(Sender: TObject); … … 58 65 FormDisassembler: TFormDisassembler; 59 66 FormStorage: TFormStorage; 60 Machine: TMachine; 61 procedure InitMachine; 62 public 67 FormDebugger: TFormDebugger; 63 68 end; 64 69 … … 72 77 73 78 uses 74 C pu, BigInt, Common;79 Core, Common, FormSettings, Common.FormAbout; 75 80 76 81 { TFormMain } … … 78 83 procedure TFormMain.FormShow(Sender: TObject); 79 84 begin 80 DockForm(FormScreen, Self); 81 Machine.PowerOn; 85 if Core.Core.StartUpForm = 'Screen' then begin 86 AScreen.Execute; 87 DockForm(FormScreen, Self); 88 end; 89 if Core.Core.StartUpForm = 'Source editor' then begin 90 ASourceEditor.Execute; 91 DockForm(FormSourceEditor, Self); 92 end; 93 if Core.Core.StartUpForm = 'Debugger' then begin 94 ADebugger.Execute; 95 DockForm(FormDebugger, Self); 96 end; 97 if Core.Core.AutoStartMachine then 98 Core.Core.Machine.PowerOn; 82 99 end; 83 100 84 101 procedure TFormMain.FormCreate(Sender: TObject); 85 102 begin 86 Machine := TMachine.Create;87 InitMachine;88 FormScreen := TFormScreen.Create(nil);89 FormConsole := TFormConsole.Create(nil);90 Machine.Serial.OnWrite := FormConsole.ConsoleWrite;91 FormScreen.FrameBuffer := Machine.FrameBuffer;92 Machine.FrameBuffer.OnChange := FormScreen.ScreenChange;93 103 end; 94 104 … … 101 111 if Assigned(FormDisassembler) then FreeAndNil(FormDisassembler); 102 112 if Assigned(FormStorage) then FreeAndNil(FormStorage); 103 FreeAndNil(Machine);113 if Assigned(FormDebugger) then FreeAndNil(FormDebugger); 104 114 end; 105 115 … … 109 119 end; 110 120 121 procedure TFormMain.ASettingsExecute(Sender: TObject); 122 var 123 FormSettings: TFormSettings; 124 begin 125 FormSettings := TFormSettings.Create(nil); 126 try 127 FormSettings.ShowModal; 128 finally 129 FormSettings.Free; 130 end; 131 end; 132 111 133 procedure TFormMain.AFullscreenExecute(Sender: TObject); 112 134 begin 113 PersistentForm1.SetFullScreen(notPersistentForm1.FormFullScreen);135 Core.Core.PersistentForm1.SetFullScreen(not Core.Core.PersistentForm1.FormFullScreen); 114 136 end; 115 137 … … 118 140 if not Assigned(FormMemory) then begin 119 141 FormMemory := TFormMemory.Create(nil); 120 FormMemory.Memory := Machine.Memory;142 FormMemory.Memory := Core.Core.Machine.Memory; 121 143 end; 122 144 FormMemory.Show; … … 125 147 procedure TFormMain.AScreenExecute(Sender: TObject); 126 148 begin 149 if not Assigned(FormScreen) then begin 150 FormScreen := TFormScreen.Create(nil); 151 FormScreen.FrameBuffer := Core.Core.Machine.FrameBuffer; 152 Core.Core.Machine.FrameBuffer.OnChange := FormScreen.ScreenChange; 153 end; 127 154 FormScreen.Show; 128 155 end; … … 130 157 procedure TFormMain.ADebuggerExecute(Sender: TObject); 131 158 begin 159 if not Assigned(FormDebugger) then begin 160 FormDebugger := TFormDebugger.Create(nil); 161 end; 162 FormDebugger.Show; 132 163 end; 133 164 134 165 procedure TFormMain.AConsoleExecute(Sender: TObject); 135 166 begin 167 if not Assigned(FormConsole) then begin 168 FormConsole := TFormConsole.Create(nil); 169 Core.Core.Machine.Serial.OnWrite := FormConsole.ConsoleWrite; 170 end; 136 171 FormConsole.Show; 172 end; 173 174 procedure TFormMain.AAboutExecute(Sender: TObject); 175 var 176 FormAbout: TFormAbout; 177 begin 178 FormAbout := TFormAbout.Create(nil); 179 try 180 FormAbout.ApplicationInfo := Core.Core.ApplicationInfo1; 181 FormAbout.ShowModal; 182 finally 183 FreeAndNil(FormAbout); 184 end; 137 185 end; 138 186 … … 141 189 if not Assigned(FormDisassembler) then 142 190 FormDisassembler := TFormDisassembler.Create(nil); 143 FormDisassembler.Disassembler.Memory := Machine.Memory;191 FormDisassembler.Disassembler.Memory := Core.Core.Machine.Memory; 144 192 FormDisassembler.Show; 145 193 end; … … 149 197 if not Assigned(FormSourceEditor) then begin 150 198 FormSourceEditor := TFormSourceEditor.Create(nil); 151 FormSourceEditor.Machine := Machine;199 FormSourceEditor.Machine := Core.Core.Machine; 152 200 end; 153 201 FormSourceEditor.Show; … … 158 206 if not Assigned(FormStorage) then begin 159 207 FormStorage := TFormStorage.Create(nil); 160 FormStorage.Storage := Machine.Storage;208 FormStorage.Storage := Core.Core.Machine.Storage; 161 209 end; 162 210 FormStorage.Show; 163 211 end; 164 212 165 procedure TFormMain.InitMachine;166 var167 Loop: TBigInt;168 begin169 with Machine.Cpu do begin170 Reset;171 172 // LD A, 'A'173 WriteInstruction(inLoadConst);174 WriteRegister(riA);175 Write(DataWidth, Ord('A'));176 177 // LD B, 8178 WriteInstruction(inLoadConst);179 WriteRegister(riB);180 Write(DataWidth, Machine.Serial.BaseAddress);181 182 // OUT (B), A183 WriteInstruction(inOutput);184 WriteRegister(riB);185 WriteRegister(riA);186 187 // LD B,188 WriteInstruction(inLoadConst);189 WriteRegister(riB);190 Write(DataWidth, Machine.FrameBuffer.BaseAddress);191 192 WriteInstruction(inLoadConst);193 WriteRegister(riC);194 Write(DataWidth, 10);195 196 Loop := PC;197 198 WriteInstruction(inOutput);199 WriteRegister(riB);200 WriteRegister(riA);201 202 WriteInstruction(inInc);203 WriteRegister(riA);204 205 WriteInstruction(inDec);206 WriteRegister(riC);207 208 WriteInstruction(inJumpNotZero);209 WriteRegister(riC);210 Write(AddressWidth, Loop);211 212 WriteInstruction(inHalt);213 end;214 end;215 216 213 end. 217 214 -
branches/ByteArray/Languages/ByteArray.cs.po
r56 r57 90 90 msgstr "Neznámý znak %s" 91 91 92 #: tcore.applicationinfo1.description 93 msgid "Virtual machine and development environment" 94 msgstr "Virtuální počítač a vývojové prostředí" 95 96 #: tformdebugger.caption 97 #, fuzzy 98 msgctxt "tformdebugger.caption" 99 msgid "Debugger" 100 msgstr "Ladič" 101 102 #: tformmain.aabout.caption 103 msgid "About" 104 msgstr "O aplikaci" 105 92 106 #: tformmain.aconsole.caption 93 107 msgctxt "tformmain.aconsole.caption" … … 96 110 97 111 #: tformmain.adebugger.caption 112 msgctxt "tformmain.adebugger.caption" 98 113 msgid "Debugger" 99 114 msgstr "Ladič" … … 126 141 msgstr "Obrazovka" 127 142 143 #: tformmain.asettings.caption 144 msgctxt "tformmain.asettings.caption" 145 msgid "Settings" 146 msgstr "Nastavení" 147 128 148 #: tformmain.asourceeditor.caption 129 149 msgctxt "tformmain.asourceeditor.caption" … … 144 164 msgstr "Pohled" 145 165 166 #: tformmain.menuitem11.caption 167 msgid "Help" 168 msgstr "Nápověda" 169 146 170 #: tformmain.menuitem2.caption 147 171 msgid "Tools" … … 173 197 msgstr "ASCII" 174 198 199 #: tformsettings.buttoncancel.caption 200 msgid "Cancel" 201 msgstr "Zrušit" 202 203 #: tformsettings.buttonok.caption 204 msgid "OK" 205 msgstr "OK" 206 207 #: tformsettings.caption 208 msgctxt "tformsettings.caption" 209 msgid "Settings" 210 msgstr "Nastavení" 211 212 #: tformsettings.checkboxautostartmachine.caption 213 msgid "Auto start machine" 214 msgstr "Automatický start stroje" 215 216 #: tformsettings.label1.caption 217 msgid "Startup form:" 218 msgstr "Startovaní okno:" 219 220 #: tformsettings.label2.caption 221 msgid "Theme:" 222 msgstr "Téma:" 223 224 #: tformsettings.label3.caption 225 msgid "Language:" 226 msgstr "Jazyk:" 227 175 228 #: tformsourceeditor.aclose.caption 176 229 msgid "Close" -
branches/ByteArray/Languages/ByteArray.pot
r56 r57 80 80 msgstr "" 81 81 82 #: tcore.applicationinfo1.description 83 msgid "Virtual machine and development environment" 84 msgstr "" 85 86 #: tformdebugger.caption 87 msgctxt "tformdebugger.caption" 88 msgid "Debugger" 89 msgstr "" 90 91 #: tformmain.aabout.caption 92 msgid "About" 93 msgstr "" 94 82 95 #: tformmain.aconsole.caption 83 96 msgctxt "tformmain.aconsole.caption" … … 86 99 87 100 #: tformmain.adebugger.caption 101 msgctxt "tformmain.adebugger.caption" 88 102 msgid "Debugger" 89 103 msgstr "" … … 116 130 msgstr "" 117 131 132 #: tformmain.asettings.caption 133 msgctxt "tformmain.asettings.caption" 134 msgid "Settings" 135 msgstr "" 136 118 137 #: tformmain.asourceeditor.caption 119 138 msgctxt "tformmain.asourceeditor.caption" … … 134 153 msgstr "" 135 154 155 #: tformmain.menuitem11.caption 156 msgid "Help" 157 msgstr "" 158 136 159 #: tformmain.menuitem2.caption 137 160 msgid "Tools" … … 163 186 msgstr "" 164 187 188 #: tformsettings.buttoncancel.caption 189 msgid "Cancel" 190 msgstr "" 191 192 #: tformsettings.buttonok.caption 193 msgid "OK" 194 msgstr "" 195 196 #: tformsettings.caption 197 msgctxt "tformsettings.caption" 198 msgid "Settings" 199 msgstr "" 200 201 #: tformsettings.checkboxautostartmachine.caption 202 msgid "Auto start machine" 203 msgstr "" 204 205 #: tformsettings.label1.caption 206 msgid "Startup form:" 207 msgstr "" 208 209 #: tformsettings.label2.caption 210 msgid "Theme:" 211 msgstr "" 212 213 #: tformsettings.label3.caption 214 msgid "Language:" 215 msgstr "" 216 165 217 #: tformsourceeditor.aclose.caption 166 218 msgid "Close" -
branches/ByteArray/Sample.asm
r56 r57 12 12 JNZ C, Loop 13 13 HALT 14 15 WriteStr: 16 PUSH R2 17 PUSH R3 18 PUSH R4 19 SET R3, ConsoleWriteChar 20 SET R4, DeviceConsole 21 WriteStrLoop: 22 LD R2, (R0) 23 OUT (R4: R3), R2 24 INC R0 25 DEC R1 26 JNZ R1, WriteStrLoop 27 POP R4 28 POP R3 29 POP R2 30 RET 31 32 ClearScreen: 33 PUSH R0 34 PUSH R1 35 PUSH R2 36 PUSH R3 37 SET R0, ScreenSetAddr 38 SET R1, 0 39 SET R3, DeviceScreen 40 OUT (R3: R0), R1 41 SET R0, ScreenGetWidth 42 IN R1, (R3: R0) 43 SET R0, ScreenGetHeight 44 IN R2, (R3: R0) 45 MUL R2, R1 46 SET R0, ScreenWrite 47 SET R1, 120 48 ClearScreenLoop: 49 OUT (R3: R0), R1 50 DEC R2 51 JNZ R2, ClearScreenLoop 52 POP R3 53 POP R2 54 POP R1 55 POP R0 56 RET 57 58 Hello: 59 DB 'Hello friend'
Note:
See TracChangeset
for help on using the changeset viewer.