- Timestamp:
- Jul 5, 2022, 8:28:18 PM (2 years ago)
- Location:
- branches/UltimatOS
- Files:
-
- 3 added
- 7 edited
- 2 moved
Legend:
- Unmodified
- Added
- Removed
-
branches/UltimatOS
-
Property svn:ignore
set to
UltimatOS
UltimatOS.lps
UltimatOS.res
lib
-
Property svn:ignore
set to
-
branches/UltimatOS/Forms/UFormMain.lfm
r29 r30 36 36 TabOrder = 1 37 37 end 38 object Label1: TLabel 39 Left = 662 40 Height = 22 41 Top = 500 42 Width = 68 43 Caption = 'Instrukcí:' 44 end 45 object ButtonMemory: TButton 46 Left = 128 47 Height = 33 48 Top = 496 49 Width = 98 50 Caption = 'Memory' 51 OnClick = ButtonMemoryClick 52 TabOrder = 2 53 end 38 54 object Timer1: TTimer 39 55 Interval = 20 -
branches/UltimatOS/Forms/UFormMain.pas
r29 r30 12 12 13 13 TFormMain = class(TForm) 14 ButtonMemory: TButton; 14 15 ButtonRun: TButton; 16 Label1: TLabel; 15 17 MemoCode: TMemo; 16 18 PaintBox1: TPaintBox; 17 19 Timer1: TTimer; 20 procedure ButtonMemoryClick(Sender: TObject); 18 21 procedure ButtonRunClick(Sender: TObject); 19 22 procedure FormCreate(Sender: TObject); … … 37 40 38 41 uses 39 UInstructionWriter ;42 UInstructionWriter, UFormMemory; 40 43 41 44 { TFormMain } … … 49 52 procedure TFormMain.ButtonRunClick(Sender: TObject); 50 53 begin 54 Machine.Reset; 51 55 with TInstructionWriter.Create do 52 56 try … … 56 60 Free; 57 61 end; 58 Machine.Reset;59 62 Machine.Cpu.Run; 63 Label1.Caption := 'Executed instructions: ' + IntToStr(Machine.Cpu.ExecutedCount); 64 end; 65 66 procedure TFormMain.ButtonMemoryClick(Sender: TObject); 67 begin 68 FormMemory.Memory := Machine.Memory; 69 FormMemory.Show; 60 70 end; 61 71 -
branches/UltimatOS/Graphics.asm
r29 r30 1 Rectangle: ; R0 - Color, R1 - Width, R2 - Height 2 PUSH R3 3 PUSH R4 4 PUSH R5 5 SET R3, 0 ; X 6 SET R4, 0 ; Screen address 7 IN R5, ScreenGetWidth 8 SHL R5, 2 ; multiply by 4 1 Rectangle: ; R0 - Color, R1 - X, R2 - Y, R3 - Width, R4 - Height 2 PUSH R5 ; loop X 3 PUSH R6 ; loop Y 4 PUSH R7 ; color 5 PUSH R8 ; X 6 PUSH R9 ; Y 7 COPY R7, R0 8 COPY R8, R1 9 COPY R9, R2 10 COPY R6, R4 11 PUSH R0 12 PUSH R1 9 13 Start: 10 OUT ScreenSetAddr, R4 11 COPY R3, R1 14 COPY R0, R8 15 COPY R1, R9 16 CALL SetPixelAddr 17 COPY R5, R3 12 18 Line: 13 OUT ScreenWriteData, R0 14 DEC R3 15 JPNZ R3, Line 16 DEC R2 17 ADD R4, R5 18 JPNZ R2, Start 19 POP R5 20 POP R4 19 OUT ScreenWriteData, R7 20 DEC R5 21 JPNZ R5, Line 22 DEC R6 23 INC R9 24 JPNZ R6, Start 25 POP R1 26 POP R0 27 POP R9 28 POP R8 29 POP R7 30 POP R6 21 31 POP R3 22 32 RET … … 55 65 IN R8, ScreenGetWidth 56 66 SET R4, CharHeight 57 SET R12, 1 67 SET R10, $ffffff 68 SET R11, 5 69 SET R13, 1 58 70 WriteCharLoopY: 59 71 COPY R0, R5 … … 73 85 DEC R9 74 86 SHR R7, 1 75 JPNZ WriteCharLoopX:87 JPNZ R9, WriteCharLoopX 76 88 DEC R4 77 ADD R2, R5 78 JPNZ WriteCharLoopY: 89 INC R6 90 INC R3 91 JPNZ R4, WriteCharLoopY 79 92 POP R13 80 93 POP R12 … … 94 107 PUSH R4 ; character width 95 108 PUSH R5 ; byte mask 109 PUSH R6 ; X 110 PUSH R7 ; Y 111 PUSH R1 112 PUSH R2 113 PUSH R0 114 COPY R6, R1 115 COPY R7, R2 116 COPY R3, R0 96 117 SET R5, $ff 97 COPY R3, R098 118 SET R4, CharWidth 99 119 TextOutLoop: … … 101 121 AND R0, R5 102 122 JPZ R0, TextOutLoop2 123 COPY R1, R6 124 COPY R2, R7 103 125 CALL WriteChar 104 ADD R 1, R4126 ADD R6, R4 105 127 INC R3 106 128 JP TextOutLoop 107 129 TextOutLoop2: 130 POP R0 131 POP R2 132 POP R1 133 POP R7 134 POP R6 135 POP R5 108 136 POP R4 109 137 POP R3 -
branches/UltimatOS/Program.asm
r29 r30 13 13 CALL TextOut 14 14 15 ;SET R0, 110 16 ;SET R1, 110 17 ;CALL SetPixelAddr 18 19 ;SET R0, 65 20 ;SET R1, 110 21 ;SET R2, 110 22 ;CALL WriteChar 23 15 24 HALT 16 25 -
branches/UltimatOS/UCpu.pas
r29 r30 31 31 function Pop: Integer; 32 32 public 33 ExecutedCount: Integer; 33 34 Terminated: Boolean; 34 35 Memory: TMemory; … … 93 94 begin 94 95 Instruction := TInstruction(ReadByte); 96 Inc(ExecutedCount); 95 97 case Instruction of 96 98 inNop: ; … … 211 213 IP := 0; 212 214 SP := 0; 215 ExecutedCount := 0; 213 216 end; 214 217 -
branches/UltimatOS/UMachine.pas
r29 r30 211 211 Screen.Reset; 212 212 Cpu.Reset; 213 FillChar(Memory.Data^, Memory.Size, 0); 213 214 end; 214 215 … … 216 217 begin 217 218 Memory := TMemory.Create; 218 Memory.Size := 65535;219 Memory.Size := 200000; 219 220 Keyboard := TKeyboard.Create; 220 221 Mouse := TMouse.Create; -
branches/UltimatOS/UltimatOS.lpi
r29 r30 24 24 <SearchPaths> 25 25 <IncludeFiles Value="$(ProjOutDir)"/> 26 <OtherUnitFiles Value="Forms"/> 26 27 <UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)-$(BuildMode)"/> 27 28 </SearchPaths> … … 72 73 </Unit> 73 74 <Unit> 74 <Filename Value=" UFormMain.pas"/>75 <Filename Value="Forms/UFormMain.pas"/> 75 76 <IsPartOfProject Value="True"/> 76 77 <ComponentName Value="FormMain"/> … … 94 95 <IsPartOfProject Value="True"/> 95 96 </Unit> 97 <Unit> 98 <Filename Value="Forms/UFormMemory.pas"/> 99 <IsPartOfProject Value="True"/> 100 <ComponentName Value="FormMemory"/> 101 <ResourceBaseClass Value="Form"/> 102 </Unit> 96 103 </Units> 97 104 </ProjectOptions> … … 103 110 <SearchPaths> 104 111 <IncludeFiles Value="$(ProjOutDir)"/> 112 <OtherUnitFiles Value="Forms"/> 105 113 <UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)-$(BuildMode)"/> 106 114 </SearchPaths> -
branches/UltimatOS/UltimatOS.lpr
r29 r30 11 11 {$ENDIF} 12 12 Interfaces, // this includes the LCL widgetset 13 Forms, UFormMain, UMachine, UCpu, UMemory, UInstructionWriter 13 Forms, UFormMain, UMachine, UCpu, UMemory, UInstructionWriter, UFormMemory 14 14 { you can add units after this }; 15 15 … … 21 21 Application.Initialize; 22 22 Application.CreateForm(TFormMain, FormMain); 23 Application.CreateForm(TFormMemory, FormMemory); 23 24 Application.Run; 24 25 end.
Note:
See TracChangeset
for help on using the changeset viewer.