git-svn-id: https://spexeah.com:8443/svn/Asuro@755 6dbc8c32-bb84-406f-8558-d1cf31a0ab0c
This commit is contained in:
1 parent
6a47590418
commit
a50e770c1a
5 files changed
+218
-21
No files matched your search
+2
-3
@@ -813,6 +813,8 @@ const
|
|||||||
DefaultWND = 0; //< The Window assigned for output when no Window is specified. (Default).
|
DefaultWND = 0; //< The Window assigned for output when no Window is specified. (Default).
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
uses
|
||||||
|
lmemorymanager, strings, keyboard, serial, terminal;
|
||||||
|
|
||||||
type
|
type
|
||||||
{ Properties pertaining to the raw screen matrix. }
|
{ Properties pertaining to the raw screen matrix. }
|
||||||
@@ -935,9 +937,6 @@ var
|
|||||||
MouseCursorEnabled : Boolean = true;
|
MouseCursorEnabled : Boolean = true;
|
||||||
OpenTerminal : Boolean = false;
|
OpenTerminal : Boolean = false;
|
||||||
|
|
||||||
uses
|
|
||||||
lmemorymanager, strings, keyboard, serial, terminal;
|
|
||||||
|
|
||||||
function getWindowColorPtr : puint32;
|
function getWindowColorPtr : puint32;
|
||||||
begin
|
begin
|
||||||
getWindowColorPtr:= @Window_Border.Attributes;
|
getWindowColorPtr:= @Window_Border.Attributes;
|
||||||
|
|||||||
@@ -351,7 +351,7 @@ begin
|
|||||||
end; //drive error
|
end; //drive error
|
||||||
end;
|
end;
|
||||||
|
|
||||||
for ii:=0 to 127 do begin //read data
|
for ii:=0 to 127 do begin //write data
|
||||||
outw($1F0, Puint32(buffer + ((i * 512) + (ii * 32) DIV 32) )^);
|
outw($1F0, Puint32(buffer + ((i * 512) + (ii * 32) DIV 32) )^);
|
||||||
while true do if (inw($1f7) and (1 shl 7)) = 0 then break; //Wait until drive not busy
|
while true do if (inw($1f7) and (1 shl 7)) = 0 then break; //Wait until drive not busy
|
||||||
outb($1F7, $E7);
|
outb($1F7, $E7);
|
||||||
|
|||||||
+120
-11
File diff suppressed because it is too large.
Load diff
@@ -35,6 +35,7 @@ type
|
|||||||
PDirectory_Entry = ^TDirectory_Entry;
|
PDirectory_Entry = ^TDirectory_Entry;
|
||||||
|
|
||||||
PPWriteHook = procedure(volume : PStorage_volume; directory : pchar; entry : PDirectory_Entry; byteCount : uint32; buffer : puint32; statusOut : puint32);
|
PPWriteHook = procedure(volume : PStorage_volume; directory : pchar; entry : PDirectory_Entry; byteCount : uint32; buffer : puint32; statusOut : puint32);
|
||||||
|
PPReadHook = function(volume : PStorage_Volume; directory : pchar; fileName : pchar; fileExtension : pchar; buffer : puint32; bytecount : puint32) : uint32;
|
||||||
PPHIOHook = procedure(volume : PStorage_device; addr : uint32; sectors : uint32; buffer : puint32);
|
PPHIOHook = procedure(volume : PStorage_device; addr : uint32; sectors : uint32; buffer : puint32);
|
||||||
PPCreateHook = procedure(disk : PStorage_Device; sectors : uint32; start : uint32; config : puint32);
|
PPCreateHook = procedure(disk : PStorage_Device; sectors : uint32; start : uint32; config : puint32);
|
||||||
PPDetectHook = procedure(disk : PStorage_Device);
|
PPDetectHook = procedure(disk : PStorage_Device);
|
||||||
@@ -46,7 +47,7 @@ type
|
|||||||
TFilesystem = record
|
TFilesystem = record
|
||||||
sName : pchar;
|
sName : pchar;
|
||||||
writeCallback : PPWriteHook;
|
writeCallback : PPWriteHook;
|
||||||
//readCallback : PPIOHook;
|
readCallback : PPReadHook;
|
||||||
createCallback : PPCreateHook;
|
createCallback : PPCreateHook;
|
||||||
detectCallback : PPDetectHook;
|
detectCallback : PPDetectHook;
|
||||||
createDirCallback : PPCreateDirHook;
|
createDirCallback : PPCreateDirHook;
|
||||||
@@ -100,6 +101,8 @@ function get_device_list() : PLinkedListBase;
|
|||||||
procedure register_filesystem(filesystem : PFilesystem);
|
procedure register_filesystem(filesystem : PFilesystem);
|
||||||
|
|
||||||
procedure register_volume(device : PStorage_Device; volume : PStorage_Volume);
|
procedure register_volume(device : PStorage_Device; volume : PStorage_Volume);
|
||||||
|
function writeNewFile(fileName : pchar; extension : pchar; buffer : puint32; size : uint32) : uint32;
|
||||||
|
function readFile(fileName : pchar; extension : pchar; buffer : puint32; byteCount : puint32) : puint32;
|
||||||
|
|
||||||
//TODO write partition table
|
//TODO write partition table
|
||||||
|
|
||||||
@@ -349,16 +352,21 @@ var
|
|||||||
buffer : puint32;
|
buffer : puint32;
|
||||||
entry : TDirectory_Entry;
|
entry : TDirectory_Entry;
|
||||||
error : puint32;
|
error : puint32;
|
||||||
|
i : uint32 = 1;
|
||||||
|
fatArray : byteArray8 = ('F','A','T','3','2',' ',' ',' ');
|
||||||
begin
|
begin
|
||||||
push_trace('txt_command');
|
push_trace('txt_command');
|
||||||
error:= puint32(kalloc(512));
|
error:= puint32(kalloc(512));
|
||||||
memset(uint32(buffer), 0, 512);
|
buffer:= puint32(kalloc(2048));
|
||||||
pchar(buffer)^ := getParam(0, params)^;
|
memset(uint32(buffer), 0, 2048);
|
||||||
|
|
||||||
entry.fileName:= 'file';
|
entry.fileName:= getParam(0, params);
|
||||||
entry.extension:= 'txt';
|
entry.extension:= 'txt';
|
||||||
entry.entryType:= TDirectory_Entry_Type.fileEntry;
|
entry.entryType:= TDirectory_Entry_Type.fileEntry;
|
||||||
|
|
||||||
|
PByteArray8(buffer)^ := fatArray;
|
||||||
|
|
||||||
|
|
||||||
push_trace('txt_cmd_');
|
push_trace('txt_cmd_');
|
||||||
rootVolume^.filesystem^.writeCallback(rootVolume, '.', @entry, stringSize(pchar(buffer)), buffer, error); //need to change the function pointer to match and impiment it in the filesystem init.
|
rootVolume^.filesystem^.writeCallback(rootVolume, '.', @entry, stringSize(pchar(buffer)), buffer, error); //need to change the function pointer to match and impiment it in the filesystem init.
|
||||||
end;
|
end;
|
||||||
@@ -418,4 +426,83 @@ begin
|
|||||||
if rootVolume = PStorage_Volume(0) then rootVolume:= volume;
|
if rootVolume = PStorage_Volume(0) then rootVolume:= volume;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function writeNewFile(fileName : pchar; extension : pchar; buffer : puint32; size : uint32) : uint32;
|
||||||
|
var
|
||||||
|
entry : TDirectory_Entry;
|
||||||
|
error : puint32;
|
||||||
|
begin
|
||||||
|
push_trace('storagemanagment.writenewfile');
|
||||||
|
error:= puint32(kalloc(512));
|
||||||
|
|
||||||
|
entry.fileName:= fileName;
|
||||||
|
entry.extension:= extension;
|
||||||
|
entry.entryType:= TDirectory_Entry_Type.fileEntry;
|
||||||
|
|
||||||
|
rootVolume^.filesystem^.writeCallback(rootVolume, getWorkingDirectory(), @entry, size, buffer, error);
|
||||||
|
writeNewFile:= error^; //memory leak
|
||||||
|
end;
|
||||||
|
|
||||||
|
function cleanString(str : pchar) : pchar;
|
||||||
|
var
|
||||||
|
i : uint32;
|
||||||
|
ii: uint32;
|
||||||
|
begin
|
||||||
|
cleanString:= pchar(kalloc(10));
|
||||||
|
memset(uint32(cleanstring), 0, 10);
|
||||||
|
for i:=0 to 7 do begin
|
||||||
|
if str[i] = char(0) then begin
|
||||||
|
for ii:=i to 7 do begin
|
||||||
|
cleanString[ii]:= ' ';
|
||||||
|
end;
|
||||||
|
break;
|
||||||
|
end else begin
|
||||||
|
cleanString[i]:= str[i];
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function readFile(fileName : pchar; extension : pchar; buffer : puint32; byteCount : puint32) : puint32; //TODO add length param
|
||||||
|
var
|
||||||
|
error : puint32;
|
||||||
|
dirs : PLinkedListBase;
|
||||||
|
exists : boolean = false;
|
||||||
|
i : uint32;
|
||||||
|
cleanFileName : pchar;
|
||||||
|
otherCleanFileName : pchar;
|
||||||
|
begin
|
||||||
|
push_trace('storagemanagement.readfile');
|
||||||
|
bytecount := puint32(kalloc(4));
|
||||||
|
error := puint32(kalloc(4));
|
||||||
|
readfile:= error;
|
||||||
|
|
||||||
|
cleanFileName := cleanString(filename);
|
||||||
|
|
||||||
|
dirs := rootVolume^.filesystem^.readdirCallback(rootVolume, getWorkingDirectory(), error);
|
||||||
|
|
||||||
|
for i:=0 to LL_Size(dirs) -1 do begin
|
||||||
|
otherCleanFileName := cleanString(PDirectory_Entry(LL_get(dirs, i))^.filename); //TODO clean extension
|
||||||
|
writestringlnWND(otherCleanFileName, getTerminalHWND());
|
||||||
|
writestringlnWND(cleanFileName, getTerminalHWND());
|
||||||
|
|
||||||
|
if stringEquals(cleanFileName, otherCleanFileName) then begin
|
||||||
|
writestringlnWND('match found!', getTerminalHWND());
|
||||||
|
|
||||||
|
exists := true;
|
||||||
|
error^ := 0;
|
||||||
|
end;
|
||||||
|
|
||||||
|
kfree(puint32(otherCleanFileName));
|
||||||
|
end;
|
||||||
|
|
||||||
|
kfree(puint32(cleanFileName));
|
||||||
|
|
||||||
|
if exists = false then begin
|
||||||
|
// TODO error codes
|
||||||
|
error^ := 1;
|
||||||
|
exit;
|
||||||
|
end;
|
||||||
|
|
||||||
|
rootVolume^.filesystem^.readCallback(rootVolume, getWorkingDirectory(), fileName, extension, buffer, bytecount);
|
||||||
|
exit;
|
||||||
|
end;
|
||||||
end.
|
end.
|
||||||
+4
-2
@@ -43,7 +43,8 @@ uses
|
|||||||
netlog,
|
netlog,
|
||||||
vmlog,
|
vmlog,
|
||||||
vm,
|
vm,
|
||||||
vmstate;
|
vmstate,
|
||||||
|
edit;
|
||||||
|
|
||||||
procedure kmain(mbinfo: Pmultiboot_info_t; mbmagic: uint32); stdcall;
|
procedure kmain(mbinfo: Pmultiboot_info_t; mbmagic: uint32); stdcall;
|
||||||
|
|
||||||
@@ -217,7 +218,8 @@ begin
|
|||||||
vmlog.init();
|
vmlog.init();
|
||||||
tracer.push_trace('kmain.VMSTATEINIT');
|
tracer.push_trace('kmain.VMSTATEINIT');
|
||||||
vmstate.init();
|
vmstate.init();
|
||||||
|
tracer.push_trace('kmain.EDIT');
|
||||||
|
edit.init();
|
||||||
terminal.run();
|
terminal.run();
|
||||||
|
|
||||||
{ Init Splash }
|
{ Init Splash }
|
||||||
|
|||||||
Reference in new issue
Block a user