Bad version (?)

This commit is contained in:
2021-09-14 19:02:20 +03:00
parent f551ca29ce
commit a58fee7200
58 changed files with 555 additions and 11189 deletions

View File

@ -21,7 +21,7 @@ string ConsoleCommands[] =
"restart",
"dir",
"cat",
"task"
"fork"
};
int32 ConsoleCommandsCount = 14;
@ -174,7 +174,7 @@ void _CommandMemPrintMemmap()
blocks = n - old;
used = 0;
for (; old < n; old++)
used += (MemPhGetBlock (old) != 0);
used += (MemPhGetFrame(old) != 0);
if (used <= blocks / 5) c = ' ';
else if (used > 4 * blocks / 5) c = 219;
@ -338,29 +338,39 @@ void CommandCat (string argv[], int32 argc)
}
#include <tasking.h>
void task()
{
Point p = {5, 1};
uint32 t = 0;
while (1)
{
ConsoleCursorGoto(p);
ConsoleWrite("Hello world! %u ", t++);
}
}
void CommandTask()
void CommandFork()
{
ConsoleClear();
TaskCreate(task);
Point p = {5, 2};
uint32 t = 0;
Point a = {5,1};
Point b = {5,2};
while (1)
// Child?
if (Fork() == 0)
{
ConsoleCursorGoto(p);
ConsoleWrite("%#Hello world! %u ", ColorLightBlue, t++);
uint32 i;
for (i = 0; i < 0x7fffffff; i++)
{
ConsoleCursorGoto(a);
ConsoleWrite ("[c] Hello %u", i);
if (i > 0x7ffffff0) i = 0;
}
for (;;);
}
// Not child?
else {
uint32 i;
for (i = 0; i < 0x7fffffff; i++)
{
ConsoleCursorGoto(b);
ConsoleWrite ("[p] world %u", i);
if (i > 0x7ffffff0) i = 0;
}
for (;;);
}
}

View File

@ -76,7 +76,7 @@ loop:
case 10: SystemReboot(); break;
case 11: CommandDir(params, count); break;
case 12: CommandCat(params, count); break;
case 13: CommandTask(); break;
case 13: CommandFork(); break;
default: ConsoleWrite ("%#! Command %#%s%# was not implemented (yet)!\n",
Color(0,ColorLightRed), Color(0,ColorWhite), params[0], Color(0,ColorLightRed)); break;

View File

@ -17,6 +17,7 @@ string LogAllowedDevices[] = {
"vfs",
//"mem",
"console",
"tasking",
0x0,
0x0
};
@ -118,9 +119,3 @@ int32 LogWrite (uint8 error, string device, string format, ...)
ConsoleCursorUpdateHardware();
return i;
}
void LogAssert (int32 condition, string file, int32 line)
{
if (!condition)
Panic("Assert", "Assertion failed in file %s line %d.\n", file, line);
}