Compare commits
22
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
07e9095582 | ||
|
|
72769fbef7 | ||
|
|
95599c0e7c | ||
|
|
fcaafa0d12 | ||
|
|
e490b95f1d | ||
|
|
b601080960 | ||
|
|
27177979a2 | ||
|
|
f88a282893 | ||
|
|
ff4c597ff3 | ||
|
|
24c371cab1 | ||
|
|
7588a4c9cb | ||
|
|
5cb415c76b | ||
|
|
118d8b0c03 | ||
|
|
28caca3bcc | ||
|
|
6476a774dc | ||
|
|
e791edb02a | ||
|
|
da36f6fabb | ||
|
|
97e1a18253 | ||
|
|
88a850e8fc | ||
|
|
10c9194c5f | ||
|
|
94b477d8f7 | ||
|
|
ba38f4fd19 |
@@ -10,5 +10,3 @@
|
||||
/*.sh~
|
||||
/*.img
|
||||
src/include/asuro.pas
|
||||
.vscode/launch.json
|
||||
.vscode
|
||||
|
||||
Vendored
+3
-10
@@ -3,18 +3,11 @@
|
||||
{
|
||||
"name":"Run",
|
||||
"request": "launch",
|
||||
"type": "coreclr",
|
||||
"type": "PowerShell",
|
||||
"preLaunchTask": "Build",
|
||||
"program": "VBoxSDL",
|
||||
"args": [
|
||||
"--comment",
|
||||
"Asuro",
|
||||
"--startvm",
|
||||
"7d395c96-891c-4139-b77d-9b6b144b0b93"
|
||||
],
|
||||
"script": "${workspaceFolder}/virtualbox-wrapper.ps1",
|
||||
"args": ["-MachineName", "7d395c96-891c-4139-b77d-9b6b144b0b93"],
|
||||
"cwd": "${workspaceFolder}",
|
||||
"console": "internalConsole",
|
||||
"internalConsoleOptions": "neverOpen"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
#Flat filesystem
|
||||
|
||||
A super simple filesystem for asuro. Folders are emulated in filenames.
|
||||
|
||||
Starts with disk info sector, sector 0 of volume
|
||||
|
||||
---
|
||||
#### disk info
|
||||
|
||||
jmp2boot : ubit24;
|
||||
OEMName : array[0..7] of char;
|
||||
version : uint16 // numerical version of filesystem
|
||||
sectorCount : uint16;
|
||||
fileCount : uint16
|
||||
signature : uint32 = 0x0B00B1E5
|
||||
|
||||
|
||||
the Rest of the sector is reserved
|
||||
|
||||
---
|
||||
|
||||
Starting from sector 1 is the file table. Table size is determined by entry size (64) * fileCount
|
||||
|
||||
---
|
||||
####File entry
|
||||
|
||||
name : array[0..59] of char //file name max 60 chars
|
||||
fileStart : 16bit // start sector of data
|
||||
fileSize : 16bit // data size in sectors
|
||||
|
||||
---
|
||||
|
||||
@@ -13,8 +13,8 @@ We welcome everyone to give building/breaking/fixing/shooting Asuro a go, feel f
|
||||
I don't think this needs an explaination.
|
||||
* [VSCode (Optional, but highly recommended)](https://code.visualstudio.com/)
|
||||
Visual Studio code is our IDE of choice, and we have a number of recommended plugins.
|
||||
* [C# Plugin by Microsoft](https://marketplace.visualstudio.com/items?itemName=ms-dotnettools.csharp)
|
||||
This plugin gives you the ability to use the 'coreclr' task type, allowing the automatic launching of virtualbox with the resulting image generated during compilation of Asuro.
|
||||
* [PowerShell Plugin by Microsoft](https://marketplace.visualstudio.com/items?itemName=ms-vscode.powershell)
|
||||
This plugin gives you the ability to use the 'PowerShell' task type, allowing the automatic launching of virtualbox with the resulting image generated during compilation of Asuro.
|
||||
* [VirtualBox](https://www.virtualbox.org/)
|
||||
Virtualbox is our Virtualisation environment of choice, don't ask why, it just is.
|
||||
|
||||
@@ -27,7 +27,7 @@ We welcome everyone to give building/breaking/fixing/shooting Asuro a go, feel f
|
||||
3. Install Docker for Windows.
|
||||
4. Install Git for Windows.
|
||||
5. Install VSCode & the listed plugins.
|
||||
6. Install VirtualBox.
|
||||
6. Install VirtualBox (v7+).
|
||||
7. Clone this repository.
|
||||
8. Run the following command in the root of the repo to build the docker image:
|
||||
```powershell
|
||||
@@ -57,18 +57,11 @@ We welcome everyone to give building/breaking/fixing/shooting Asuro a go, feel f
|
||||
{
|
||||
"name":"Run",
|
||||
"request": "launch",
|
||||
"type": "coreclr",
|
||||
"type": "PowerShell",
|
||||
"preLaunchTask": "Build",
|
||||
"program": "VBoxSDL",
|
||||
"args": [
|
||||
"--comment",
|
||||
"Asuro",
|
||||
"--startvm",
|
||||
"<YOUR UUID HERE>"
|
||||
],
|
||||
"script": "${workspaceFolder}/virtualbox-wrapper.ps1",
|
||||
"args": ["-MachineName", "7d395c96-891c-4139-b77d-9b6b144b0b93"],
|
||||
"cwd": "${workspaceFolder}",
|
||||
"console": "internalConsole",
|
||||
"internalConsoleOptions": "neverOpen"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -77,5 +70,6 @@ We welcome everyone to give building/breaking/fixing/shooting Asuro a go, feel f
|
||||
13. Open your project folder in VSCode, use CTRL+SHIFT+B to build & F5 to build + run in VBox.
|
||||
14. Congratulations! You can now play with Asuro!
|
||||
|
||||
### Gotchas
|
||||
### Notes & Gotchas
|
||||
- The above process has been updated to be compatible with VirtualBox 7+, in which VBoxSDL was removed and vboxmanage should be used in its place. A small wrapper powershell script is used to achieve this.
|
||||
- It was noted that Windows builds above `20H2` seem to have issues installing WSL2. We may have to wait for a patch from Microsoft to fix this. Our devs are currently using build `20H2`.
|
||||
|
||||
@@ -21,7 +21,9 @@ uses
|
||||
lmemorymanager,
|
||||
storagemanagement,
|
||||
strings,
|
||||
tracer;
|
||||
tracer,
|
||||
drivemanager,
|
||||
storagetypes;
|
||||
|
||||
type
|
||||
TPortMode = (P_READ, P_WRITE);
|
||||
@@ -267,6 +269,7 @@ var
|
||||
slaveDevice : TStorage_Device;
|
||||
buffer : puint8;
|
||||
i : uint8;
|
||||
test : PStorage_device;
|
||||
begin
|
||||
push_trace('ide.load');
|
||||
console.writestringln('[IDE] (LOAD) BEGIN');
|
||||
@@ -288,14 +291,15 @@ begin
|
||||
exit;
|
||||
end;
|
||||
|
||||
masterDevice.hpc:= uint32(IDEDevices[0].info[3] DIV IDEDevices[0].info[1]);
|
||||
// masterDevice.hpc:= uint32(IDEDevices[0].info[3] DIV IDEDevices[0].info[1]); //TODO wtf is hpc
|
||||
|
||||
masterDevice.sectorSize:= 512;
|
||||
if masterDevice.maxSectorCount <> 0 then begin
|
||||
IDEDevices[0].exists:= true;
|
||||
masterDevice.readCallback:= @dread;
|
||||
masterDevice.writeCallback:= @dwrite;
|
||||
storagemanagement.register_device(@masterDevice);
|
||||
// storagemanagement.register_device(@masterDevice);
|
||||
drivemanager.register_device(@masterDevice);
|
||||
end;
|
||||
|
||||
end;
|
||||
@@ -330,10 +334,14 @@ var
|
||||
device: uint8;
|
||||
data: uint16;
|
||||
begin
|
||||
if not validate_28bit_address(LBA) then begin
|
||||
push_trace('IDE.readPIO28');
|
||||
|
||||
if not validate_28bit_address(LBA) then begin
|
||||
console.writestringln('IDE (writePIO28) ERROR: Invalid LBA!');
|
||||
end;
|
||||
|
||||
// push_trace('IDE.readPIO28.2');
|
||||
|
||||
//Add last 4 bits of LBA to device port
|
||||
if IDEDevices[drive].isMaster then begin
|
||||
device:= ATA_DEVICE_MASTER;
|
||||
@@ -344,6 +352,8 @@ begin
|
||||
device_select($F0 or ((LBA and $0F000000) shr 24)); //LBA primary slave
|
||||
end;
|
||||
|
||||
// push_trace('IDE.readPIO28.3');
|
||||
|
||||
no_interrupt(device);
|
||||
port_write(ATA_REG_ERROR, 0);
|
||||
|
||||
@@ -353,6 +363,8 @@ begin
|
||||
port_write(ATA_REG_LBA1, (LBA and $0000FF00) shr 8);
|
||||
port_write(ATA_REG_LBA2, (LBA and $00FF0000) shr 16);
|
||||
|
||||
// push_trace('IDE.readPIO28.4');
|
||||
|
||||
//send read command
|
||||
port_write(ATA_REG_COMMAND, ATA_CMD_READ_PIO);
|
||||
if not is_ready() then exit;
|
||||
@@ -368,6 +380,8 @@ begin
|
||||
|
||||
i:= i + 2;
|
||||
end;
|
||||
|
||||
// push_trace('IDE.readPIO28.5');
|
||||
end;
|
||||
|
||||
procedure writePIO28(drive : uint8; LBA : uint32; buffer : puint8);
|
||||
@@ -430,8 +444,10 @@ procedure dread(device : PStorage_device; LBA : uint32; sectorCount : uint32; bu
|
||||
var
|
||||
i : uint16;
|
||||
begin
|
||||
push_trace('IDE.dread');
|
||||
for i:=0 to sectorCount-1 do begin
|
||||
readPIO28(device^.controllerId0, LBA, puint8(@buffer[512*i]));
|
||||
readPIO28(device^.controllerId0, LBA + i, puint8(@buffer[512*i]));
|
||||
psleep(100)
|
||||
end;
|
||||
end;
|
||||
|
||||
@@ -440,7 +456,8 @@ var
|
||||
i : uint16;
|
||||
begin
|
||||
for i:=0 to sectorCount-1 do begin
|
||||
writePIO28(device^.controllerId0, LBA, puint8(@buffer[512*i]));
|
||||
writePIO28(device^.controllerId0, LBA + i, puint8(@buffer[512*i]));
|
||||
psleep(100)
|
||||
end;
|
||||
// writePIO28(device^.controllerId0, LBA, puint8(buffer));
|
||||
end;
|
||||
|
||||
@@ -0,0 +1,81 @@
|
||||
{
|
||||
Driver->Storage->MBR Master boot record
|
||||
|
||||
@author(Aaron Hance [email protected])
|
||||
}
|
||||
unit mbr;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
tracer;
|
||||
|
||||
type
|
||||
|
||||
PMaster_Boot_Record = ^TMaster_Boot_Record;
|
||||
PPartition_table = ^TPartition_table;
|
||||
|
||||
TPartition_table = bitpacked record
|
||||
attributes : uint8;
|
||||
CHS_start : array[0..2] of uint8;
|
||||
system_id : uint8;
|
||||
CHS_end : array[0..2] of uint8;
|
||||
LBA_start : uInt32;
|
||||
sector_count : uInt32;
|
||||
end;
|
||||
|
||||
TMaster_Boot_Record = bitpacked record
|
||||
bootstrap : array[0..439] of uint8;
|
||||
signature : uint32;
|
||||
rsv : uint16;
|
||||
partition : array[0..3] of TPartition_table;
|
||||
boot_sector : uint16;
|
||||
end;
|
||||
|
||||
T24bit = array[0..2] of uint8;
|
||||
|
||||
function get_bootable(partition_table : PPartition_table) : boolean;
|
||||
procedure set_bootable(partition_table : PPartition_table);
|
||||
procedure setup_partition(partition_table : PPartition_table; address : uint32; sectorSize : uint32);
|
||||
|
||||
implementation
|
||||
|
||||
{ convert LBA address to CHS address}
|
||||
function LBA_2_CHS(lba : uint32) : T24bit;
|
||||
var
|
||||
dat : T24bit;
|
||||
begin
|
||||
//TODO impliment procedure
|
||||
LBA_2_CHS := dat;
|
||||
end;
|
||||
|
||||
{ Set a partition struct to be bootable}
|
||||
procedure set_bootable(partition_table : PPartition_table);
|
||||
begin
|
||||
push_trace('MBR.set_bootable');
|
||||
//set the bootble bit in attributes
|
||||
partition_table^.attributes := (partition_table^.attributes and $80);
|
||||
end;
|
||||
|
||||
{ Check a partitions bootable bit }
|
||||
function get_bootable(partition_table : PPartition_table) : boolean;
|
||||
begin
|
||||
push_trace('MBR.get_bootable');
|
||||
//get the bootble bit in attributes
|
||||
get_bootable := (partition_table^.attributes and $80) = $80;
|
||||
end;
|
||||
|
||||
{ Setup a partition table struct }
|
||||
procedure setup_partition(partition_table : PPartition_table; address : uint32; sectorSize : uint32);
|
||||
begin
|
||||
push_trace('MBR.setup_partition');
|
||||
//set values in both LBA and CHS addressing schemes
|
||||
partition_table^.LBA_start := address;
|
||||
partition_table^.sector_count := sectorSize;
|
||||
partition_table^.CHS_start := LBA_2_CHS(address);
|
||||
partition_table^.CHS_start := LBA_2_CHS(address + sectorSize);
|
||||
push_trace('MBR.setup_partition.end');
|
||||
end;
|
||||
|
||||
|
||||
end.
|
||||
File diff suppressed because it is too large
Load Diff
@@ -10,14 +10,16 @@ interface
|
||||
|
||||
uses
|
||||
console,
|
||||
storagemanagement,
|
||||
util, terminal,
|
||||
util,
|
||||
terminal,
|
||||
lmemorymanager,
|
||||
strings,
|
||||
lists,
|
||||
tracer,
|
||||
serial,
|
||||
rtc;
|
||||
rtc,
|
||||
volumemanager,
|
||||
storagetypes;
|
||||
|
||||
type
|
||||
|
||||
@@ -89,7 +91,7 @@ var
|
||||
filesystem : TFilesystem;
|
||||
|
||||
procedure init;
|
||||
procedure create_volume(disk : PStorage_Device; sectors : uint32; start : uint32; config : puint32);
|
||||
procedure create_volume(volume : PStorage_Volume; sectors : uint32; start : uint32; config : puint32);
|
||||
procedure detect_volumes(disk : PStorage_Device);
|
||||
//function writeDirectory(volume : PStorage_volume; directory : pchar; attributes : uint32) : uint8; // need to handle parent table cluster overflow, need to take attributes
|
||||
//function readDirectory(volume : PStorage_volume; directory : pchar; listPtr : PLinkedListBase) : uint8; //returns: 0 = success, 1 = dir not exsist, 2 = not directory, 3 = error
|
||||
@@ -751,7 +753,7 @@ end;
|
||||
|
||||
//TODO check directory commands for errors with a clean disk
|
||||
|
||||
procedure create_volume(disk : PStorage_Device; sectors : uint32; start : uint32; config : puint32);
|
||||
procedure create_volume(volume : PStorage_Volume; sectors : uint32; start : uint32; config : puint32);
|
||||
var
|
||||
buffer : puint32;
|
||||
bt: puint32;
|
||||
@@ -772,9 +774,18 @@ var
|
||||
programFileArray : byteArray8 = ('P','R','O','G','R','A','M','S');
|
||||
rootCluster : uint32 = 1;
|
||||
|
||||
sysArray : byteArray8 = ('S','Y','S','T','E','M',' ',' ');
|
||||
progArray : byteArray8 = ('P','R','O','G','R','A','M','S');
|
||||
userArray : byteArray8 = ('U','S','E','R',' ',' ',' ',' ');
|
||||
|
||||
status : puint32;
|
||||
disk : PStorage_device;
|
||||
|
||||
begin //maybe increase buffer size by one?
|
||||
push_trace('fat32.create_volume()');
|
||||
|
||||
disk := volume^.device;
|
||||
|
||||
// zeroBuffer:= puint32(kalloc( disk^.sectorSize * 4 ));
|
||||
// memset(uint32(zeroBuffer), 0, disk^.sectorSize * 4);
|
||||
|
||||
@@ -811,7 +822,7 @@ begin //maybe increase buffer size by one?
|
||||
bootRecord^.jmp2boot := $0; //TODO impliment boot jump
|
||||
bootRecord^.OEMName := asuroArray;
|
||||
bootRecord^.sectorSize := disk^.sectorsize;
|
||||
bootRecord^.spc := config^;
|
||||
bootRecord^.spc := 1;
|
||||
bootRecord^.rsvSectors := 32; //32 is standard
|
||||
bootRecord^.numFats := 1;
|
||||
bootRecord^.mediaDescp := $F8;
|
||||
@@ -873,8 +884,16 @@ begin //maybe increase buffer size by one?
|
||||
|
||||
disk^.writecallback(disk, dataStart + (config^ * rootCluster), 1, buffer);
|
||||
|
||||
memset(uint32(buffer), 0, disk^.sectorsize);
|
||||
|
||||
status := puint32(kalloc(sizeof(uint32)));
|
||||
writeDirectory(volume, '', sysArray, $10, status, '');
|
||||
|
||||
|
||||
kfree(buffer);
|
||||
|
||||
|
||||
|
||||
end;
|
||||
|
||||
procedure detect_volumes(disk : PStorage_Device);
|
||||
@@ -903,11 +922,11 @@ begin
|
||||
if (puint32(buffer)[127] = $55AA) and (PBootRecord(buffer)^.bsignature = $29) then begin //TODO partition table
|
||||
console.writestringln('FAT32: volume found!');
|
||||
volume^.device:= disk;
|
||||
volume^.sectorStart:= 1;
|
||||
volume^.sectorStart:= 1; //THIS MAKE SURE IF NOT FUCKY, cos im getting info from 2
|
||||
volume^.sectorSize:= PBootRecord(buffer)^.sectorSize;
|
||||
volume^.freeSectors:= 1000000; //TODO implement get free sectors need FSINFO implemented first
|
||||
volume^.filesystem := @filesystem;
|
||||
storagemanagement.register_volume(disk, volume);
|
||||
// storagemanagement.register_volume(disk, volume); TODO repalce with new thing
|
||||
end;
|
||||
|
||||
kfree(buffer);
|
||||
@@ -917,6 +936,7 @@ procedure init();
|
||||
begin
|
||||
push_trace('fat32.init()');
|
||||
filesystem.sName:= 'FAT32';
|
||||
filesystem.system_id:= $01;
|
||||
filesystem.readDirCallback:= @readDirectoryGen;
|
||||
filesystem.createDirCallback:= @writeDirectoryGen;
|
||||
filesystem.createcallback:= @create_volume;
|
||||
@@ -924,7 +944,7 @@ begin
|
||||
filesystem.writecallback:= @writeFile;
|
||||
filesystem.readcallback := @readFile;
|
||||
|
||||
storagemanagement.register_filesystem(@filesystem);
|
||||
volumemanager.register_filesystem(@filesystem);
|
||||
end;
|
||||
|
||||
end.
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,64 @@
|
||||
// Copyright 2021 Aaron Hance
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
{
|
||||
Driver->Storage->Include->storagetypes - Structs & Data Shared Across Storage Drivers.
|
||||
|
||||
@author(Aaron Hance <[email protected]>)
|
||||
}
|
||||
unit storagetypes;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
lists;
|
||||
|
||||
type
|
||||
|
||||
TControllerType = (ControllerIDE, ControllerUSB, ControllerAHCI,
|
||||
ControllerNET, ControllerRAM, rsvctr1, rsvctr2, rsvctr3);
|
||||
|
||||
PStorage_device = ^TStorage_Device;
|
||||
PDrive_Error = ^TDrive_Error;
|
||||
|
||||
PPHIOHook = procedure(drive : PStorage_device; addr : uint32; sectors : uint32; buffer : puint32);
|
||||
PPHIOHook_ = procedure;
|
||||
|
||||
byteArray8 = array[0..7] of char;
|
||||
PByteArray8 = ^byteArray8;
|
||||
|
||||
{ Generic storage device }
|
||||
TStorage_Device = record
|
||||
id : uint8;
|
||||
controller : TControllerType;
|
||||
controllerId0 : uint32;
|
||||
writable : boolean;
|
||||
volumes : PLinkedListBase;
|
||||
writeCallback : PPHIOHook;
|
||||
readCallback : PPHIOHook;
|
||||
maxSectorCount : uint32;
|
||||
sectorSize : uint32;
|
||||
end;
|
||||
|
||||
TDrive_Error = record
|
||||
code : uint16;
|
||||
description : pchar;
|
||||
recoverable : boolean;
|
||||
end;
|
||||
|
||||
|
||||
implementation
|
||||
|
||||
|
||||
end.
|
||||
File diff suppressed because it is too large
Load Diff
@@ -16,6 +16,7 @@
|
||||
Include->Strings - String Manipulation.
|
||||
|
||||
@author(Kieron Morris <[email protected]>)
|
||||
@author(Aaron Hance <[email protected]>)
|
||||
}
|
||||
unit strings;
|
||||
|
||||
@@ -33,6 +34,10 @@ function stringCopy(str : pchar) : pchar;
|
||||
function stringNew(size : uint32) : pchar;
|
||||
function stringSize(str : pchar) : uint32;
|
||||
function stringConcat(str1, str2 : pchar) : pchar;
|
||||
function stringTrim(str : pchar; length : uint32) : pchar;
|
||||
function stringSub(str : pchar; start, size : uint32) : pchar;
|
||||
function stringReplace(str, find, replace : pchar) : pchar;
|
||||
function stringIndexOf(str, find : pchar) : sint32;
|
||||
function stringContains(str : pchar; sub : pchar) : boolean;
|
||||
function stringToInt(str : pchar) : uint32;
|
||||
function hexStringToInt(str : pchar) : uint32;
|
||||
@@ -151,6 +156,94 @@ begin
|
||||
stringConcat:= result;
|
||||
end;
|
||||
|
||||
// Trim the string to the specified length.
|
||||
function stringTrim(str : pchar; length : uInt32) : pchar;
|
||||
var
|
||||
result : pchar;
|
||||
begin
|
||||
result:= stringNew(length);
|
||||
memcpy(uint32(str), uint32(result), length);
|
||||
stringTrim:= result;
|
||||
end;
|
||||
|
||||
// Return a substring of the string.
|
||||
function stringSub(str : pchar; start, size : uint32) : pchar;
|
||||
var
|
||||
result : pchar;
|
||||
begin
|
||||
result:= stringNew(size);
|
||||
memcpy(uint32(str)+start, uint32(result), size);
|
||||
stringSub:= result;
|
||||
end;
|
||||
|
||||
// Replace first instance of a string with another.
|
||||
function stringReplace(str, find, replace : pchar) : pchar;
|
||||
var
|
||||
result : pchar;
|
||||
i, j, k : uint32;
|
||||
found : boolean;
|
||||
begin
|
||||
|
||||
// Find the first instance of the find string.
|
||||
i:= 0;
|
||||
found:= false;
|
||||
while (i < stringSize(str)) and (not found) do begin
|
||||
if stringEquals(str+i, find) then begin
|
||||
found:= true;
|
||||
end else begin
|
||||
inc(i);
|
||||
end;
|
||||
end;
|
||||
|
||||
// If we found the find string, replace it.
|
||||
if found then begin
|
||||
result:= stringNew(stringSize(str) - stringSize(find) + stringSize(replace));
|
||||
j:= 0;
|
||||
k:= 0;
|
||||
while i < stringSize(str) do begin
|
||||
if stringEquals(str+i, find) then begin
|
||||
memcpy(uint32(replace), uint32(result+j), stringSize(replace));
|
||||
j:= j + stringSize(replace);
|
||||
inc(i, stringSize(find));
|
||||
end else begin
|
||||
result[j]:= str[i];
|
||||
inc(j);
|
||||
inc(i);
|
||||
end;
|
||||
end;
|
||||
stringReplace:= result;
|
||||
end else begin
|
||||
stringReplace:= stringCopy(str);
|
||||
end;
|
||||
|
||||
// Return the result.
|
||||
stringReplace:= result;
|
||||
|
||||
end;
|
||||
|
||||
|
||||
// Find the index of the first instance of a string.
|
||||
function stringIndexOf(str, find : pchar) : sint32;
|
||||
var
|
||||
i : uint32;
|
||||
found : boolean;
|
||||
begin
|
||||
i:= 0;
|
||||
found:= false;
|
||||
while (i < stringSize(str)) and (not found) do begin
|
||||
if stringEquals(str+i, find) then begin
|
||||
found:= true;
|
||||
end else begin
|
||||
inc(i);
|
||||
end;
|
||||
end;
|
||||
if found then begin
|
||||
stringIndexOf:= i;
|
||||
end else begin
|
||||
stringIndexOf:= -1;
|
||||
end;
|
||||
end;
|
||||
|
||||
function stringContains(str : pchar; sub : pchar) : boolean;
|
||||
var
|
||||
strEnd, subEnd, i, j, count : uint32;
|
||||
|
||||
+7
-1
@@ -41,9 +41,12 @@ uses
|
||||
E1000,
|
||||
IDE,
|
||||
storagemanagement,
|
||||
drivemanager,
|
||||
volumemanager,
|
||||
lists,
|
||||
net,
|
||||
fat32,
|
||||
flatfs,
|
||||
isrmanager,
|
||||
faults,
|
||||
fonts,
|
||||
@@ -205,7 +208,9 @@ begin
|
||||
tracer.push_trace('kmain.DRVMGMT');
|
||||
drivermanagement.init();
|
||||
tracer.push_trace('kmain.STRMGMT');
|
||||
storagemanagement.init();
|
||||
// storagemanagement.init();
|
||||
drivemanager.init();
|
||||
volumemanager.init();
|
||||
|
||||
{ Hook Timer for Ticks }
|
||||
tracer.push_trace('kmain.TMR');
|
||||
@@ -214,6 +219,7 @@ begin
|
||||
|
||||
{ Filsystems }
|
||||
fat32.init();
|
||||
flatfs.init();
|
||||
|
||||
{ Device Drivers }
|
||||
tracer.push_trace('kmain.DEVDRV');
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
param (
|
||||
$MachineName
|
||||
)
|
||||
|
||||
VBoxManage.exe startvm $MachineName
|
||||
|
||||
$running=$true
|
||||
while($running) {
|
||||
Start-Sleep -Seconds 1
|
||||
$status=(VBoxManage.exe list runningvms)
|
||||
if($status) {
|
||||
$running=$status.contains($MachineName)
|
||||
} else {
|
||||
$running=$false
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user