More terminal changes.
git-svn-id: https://spexeah.com:8443/svn/Asuro@223 6dbc8c32-bb84-406f-8558-d1cf31a0ab0c
This commit is contained in:
		
							
								
								
									
										
											BIN
										
									
								
								bin/kernel.bin
									
									
									
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								bin/kernel.bin
									
									
									
									
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								lib/PCI.ppu
									
									
									
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								lib/PCI.ppu
									
									
									
									
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								lib/console.ppu
									
									
									
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								lib/console.ppu
									
									
									
									
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								lib/kernel.ppu
									
									
									
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								lib/kernel.ppu
									
									
									
									
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								lib/libpsystem.a
									
									
									
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								lib/libpsystem.a
									
									
									
									
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							| @@ -40,6 +40,19 @@ begin | |||||||
|    Terminal.run; |    Terminal.run; | ||||||
| end; | end; | ||||||
|  |  | ||||||
|  | procedure terminal_command_meminfo(buffer : TCommandBuffer); | ||||||
|  | begin | ||||||
|  |     console.writestring('Lower Memory = '); | ||||||
|  |     console.writeint(multibootinfo^.mem_lower); | ||||||
|  |     console.writestringln('KB'); | ||||||
|  |     console.writestring('Higher Memory = '); | ||||||
|  |     console.writeint(multibootinfo^.mem_upper); | ||||||
|  |     console.writestringln('KB'); | ||||||
|  |     console.writestring('Total Memory = '); | ||||||
|  |     console.writeint(((multibootinfo^.mem_upper + 1000) div 1024) + 1); | ||||||
|  |     console.writestringln('MB'); | ||||||
|  | end; | ||||||
|  |  | ||||||
| procedure kmain(mbinfo: Pmultiboot_info_t; mbmagic: uint32); stdcall; [public, alias: 'kmain'];    | procedure kmain(mbinfo: Pmultiboot_info_t; mbmagic: uint32); stdcall; [public, alias: 'kmain'];    | ||||||
| var | var | ||||||
|    c               : uint8; |    c               : uint8; | ||||||
| @@ -55,6 +68,9 @@ begin | |||||||
|      multibootinfo:= mbinfo; |      multibootinfo:= mbinfo; | ||||||
|      multibootmagic:= mbmagic; |      multibootmagic:= mbmagic; | ||||||
|  |  | ||||||
|  |      terminal.init(); | ||||||
|  |      terminal.registerCommand('MEMINFO', @terminal_command_meminfo, 'Print Simple Memory Information.'); | ||||||
|  |  | ||||||
|      console.init(); |      console.init(); | ||||||
|  |  | ||||||
|      console.writestringln('Booting Asuro...'); |      console.writestringln('Booting Asuro...'); | ||||||
| @@ -103,13 +119,13 @@ begin | |||||||
|      console.writestringln(''); |      console.writestringln(''); | ||||||
|      console.setdefaultattribute(console.combinecolors(White, Black)); |      console.setdefaultattribute(console.combinecolors(White, Black)); | ||||||
|      console.writestring('Lower Memory = '); |      console.writestring('Lower Memory = '); | ||||||
|      console.writeint(mbinfo^.mem_lower); |      console.writeint(multibootinfo^.mem_lower); | ||||||
|      console.writestringln('KB'); |      console.writestringln('KB'); | ||||||
|      console.writestring('Higher Memory = '); |      console.writestring('Higher Memory = '); | ||||||
|      console.writeint(mbinfo^.mem_upper); |      console.writeint(multibootinfo^.mem_upper); | ||||||
|      console.writestringln('KB'); |      console.writestringln('KB'); | ||||||
|      console.writestring('Total Memory = '); |      console.writestring('Total Memory = '); | ||||||
|      console.writeint(((mbinfo^.mem_upper + 1000) div 1024) + 1); |      console.writeint(((multibootinfo^.mem_upper + 1000) div 1024) + 1); | ||||||
|      console.writestringln('MB'); |      console.writestringln('MB'); | ||||||
|      console.setdefaultattribute(console.combinecolors(White, Black)); |      console.setdefaultattribute(console.combinecolors(White, Black)); | ||||||
|      console.writestringln(''); |      console.writestringln(''); | ||||||
|   | |||||||
| @@ -14,7 +14,8 @@ interface | |||||||
| uses | uses | ||||||
|     console, |     console, | ||||||
|     isr32, |     isr32, | ||||||
|     lmemorymanager; |     lmemorymanager, | ||||||
|  |     terminal; | ||||||
|  |  | ||||||
| const | const | ||||||
|     Quantum = 64; |     Quantum = 64; | ||||||
| @@ -79,6 +80,29 @@ begin | |||||||
|     end; |     end; | ||||||
| end; | end; | ||||||
|  |  | ||||||
|  | procedure terminal_command_tasks(buffer : TCommandBuffer); | ||||||
|  | var | ||||||
|  |     list : PScheduler_Entry; | ||||||
|  |  | ||||||
|  | begin | ||||||
|  |     console.writestringln('ThreadID - Priority - Delta'); | ||||||
|  |     list:= Root_Task; | ||||||
|  |     console.writeint(list^.ThreadID); | ||||||
|  |     console.writestring('        - '); | ||||||
|  |     console.writeint(list^.Priority); | ||||||
|  |     console.writestring('        - '); | ||||||
|  |     console.writeintln(list^.Delta); | ||||||
|  |     list:= PScheduler_Entry(list^.Next); | ||||||
|  |     while list <> Root_Task do begin | ||||||
|  |         console.writeint(list^.ThreadID); | ||||||
|  |         console.writestring('        - '); | ||||||
|  |         console.writeint(list^.Priority); | ||||||
|  |         console.writestring('        - '); | ||||||
|  |         console.writeintln(list^.Delta); | ||||||
|  |         list:= PScheduler_Entry(list^.Next); | ||||||
|  |     end; | ||||||
|  | end; | ||||||
|  |  | ||||||
| procedure init; | procedure init; | ||||||
| begin | begin | ||||||
|     console.writestringln('SCHEDULER: INIT BEGIN.'); |     console.writestringln('SCHEDULER: INIT BEGIN.'); | ||||||
| @@ -91,6 +115,7 @@ begin | |||||||
|     Tick:= 0; |     Tick:= 0; | ||||||
|     Active:= False; |     Active:= False; | ||||||
|     isr32.hook(uint32(@delta)); |     isr32.hook(uint32(@delta)); | ||||||
|  |     terminal.registerCommand('TASKS', @terminal_command_tasks, 'List Active Processes.'); | ||||||
|     console.writestringln('SCHEDULER: INIT END.'); |     console.writestringln('SCHEDULER: INIT END.'); | ||||||
| end; | end; | ||||||
|  |  | ||||||
|   | |||||||
| @@ -11,9 +11,10 @@ type | |||||||
|     TCommandBuffer = array[0..1023] of byte; |     TCommandBuffer = array[0..1023] of byte; | ||||||
|     TCommandMethod = procedure(buf : TCommandBuffer); |     TCommandMethod = procedure(buf : TCommandBuffer); | ||||||
|     TCommand = record |     TCommand = record | ||||||
|         registered : boolean; |         registered  : boolean; | ||||||
|         command    : pchar; |         command     : pchar; | ||||||
|         method     : TCommandMethod; |         method      : TCommandMethod; | ||||||
|  |         description : pchar; | ||||||
|     end; |     end; | ||||||
|  |  | ||||||
| var | var | ||||||
| @@ -22,16 +23,37 @@ var | |||||||
|     Commands : array[0..65534] of TCommand; |     Commands : array[0..65534] of TCommand; | ||||||
|  |  | ||||||
| procedure run; | procedure run; | ||||||
| procedure registerCommand(command : pchar; method : TCommandMethod); | procedure init; | ||||||
|  | procedure registerCommand(command : pchar; method : TCommandMethod; description : pchar); | ||||||
|  |  | ||||||
| implementation | implementation | ||||||
|  |  | ||||||
| procedure version(buffer : TCommandBuffer); | procedure clear(buffer : TCommandBuffer); | ||||||
| begin | begin | ||||||
|     writestringln('Asuro v1.0'); |     console.clear(); | ||||||
| end; | end; | ||||||
|  |  | ||||||
| procedure registerCommand(command : pchar; method : TCommandMethod); | procedure version(buffer : TCommandBuffer); | ||||||
|  | begin | ||||||
|  |     console.writestringln('Asuro v1.0'); | ||||||
|  | end; | ||||||
|  |  | ||||||
|  | procedure help(buffer : TCommandBuffer); | ||||||
|  | var | ||||||
|  |     i : uint32; | ||||||
|  | begin | ||||||
|  |     console.writestringln('Registered Commands: '); | ||||||
|  |     for i:=0 to 65534 do begin | ||||||
|  |         if Commands[i].Registered then begin | ||||||
|  |             console.writestring('  '); | ||||||
|  |             console.writestring(Commands[i].command); | ||||||
|  |             console.writestring(' - '); | ||||||
|  |             console.writestringln(Commands[i].description); | ||||||
|  |         end; | ||||||
|  |     end; | ||||||
|  | end; | ||||||
|  |  | ||||||
|  | procedure registerCommand(command : pchar; method : TCommandMethod; description : pchar); | ||||||
| var | var | ||||||
|     index : uint32; |     index : uint32; | ||||||
|  |  | ||||||
| @@ -41,6 +63,7 @@ begin | |||||||
|     Commands[index].registered:= true; |     Commands[index].registered:= true; | ||||||
|     Commands[index].Command:= command; |     Commands[index].Command:= command; | ||||||
|     Commands[index].method:= method; |     Commands[index].method:= method; | ||||||
|  |     Commands[index].description:= description; | ||||||
| end; | end; | ||||||
|  |  | ||||||
| procedure upper; | procedure upper; | ||||||
| @@ -63,7 +86,10 @@ var | |||||||
| begin | begin | ||||||
|     isCommand:= true; |     isCommand:= true; | ||||||
|     for i:=0 to bIndex do begin |     for i:=0 to bIndex do begin | ||||||
|         if char(buffer[i]) = ' ' then exit; |         if char(buffer[i]) = ' ' then begin | ||||||
|  |             if i = 0 then isCommand:= false; | ||||||
|  |             exit; | ||||||
|  |         end; | ||||||
|         if char(buffer[i]) <> char(command[i]) then begin |         if char(buffer[i]) <> char(command[i]) then begin | ||||||
|             isCommand:= false; |             isCommand:= false; | ||||||
|             exit; |             exit; | ||||||
| @@ -117,11 +143,17 @@ begin | |||||||
|     end; |     end; | ||||||
| end; | end; | ||||||
|  |  | ||||||
| procedure run; | procedure init; | ||||||
| begin | begin | ||||||
|     memset(uint32(@Commands[0]), 0, 65535*sizeof(TCommand)); |     memset(uint32(@Commands[0]), 0, 65535*sizeof(TCommand)); | ||||||
|     memset(uint32(@buffer[0]), 0, 1024); |     memset(uint32(@buffer[0]), 0, 1024); | ||||||
|     registerCommand('VERSION', @version); |     registerCommand('VERSION', @version, 'Display the running version of Asuro.'); | ||||||
|  |     registerCommand('CLEAR', @clear, 'Clear the Screen.'); | ||||||
|  |     registerCommand('HELP', @help, 'Lists all registered commands and their description.') | ||||||
|  | end; | ||||||
|  |  | ||||||
|  | procedure run; | ||||||
|  | begin | ||||||
|     keyboard.hook(@key_event); |     keyboard.hook(@key_event); | ||||||
|     console.clear(); |     console.clear(); | ||||||
|     console.writestring('Asuro#> '); |     console.writestring('Asuro#> '); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 kieron
					kieron