Skip to content

Commit 906145c

Browse files
committed
more docs.
1 parent da923f4 commit 906145c

2 files changed

Lines changed: 19 additions & 8 deletions

File tree

docs/instructions/kernel.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,14 @@ You use `sysenter` to expose a specific kernel module to the program, and `sysca
7878
| `crypto` | `3` | `tlr`, `stl` | Performs XOR decryption on a string stored in `tlr`. The result is stored in `tlr`. Store a specific key into `stl`. |
7979
| `tuple` | `1` | `tlr` | Get tuple size, `tlr` is a reference to a tuple. Result is stored in `tlr`. |
8080
| `ctx` | `1` | `tlr` | Get context size, `tlr` is a reference to a context. Result is stored in `tlr`. |
81+
| `fs/vdsk` | `1` | `tlr`, `stl` | Create a file named `tlr`, with content in `stl`. |
82+
| `fs/vdsk` | `2` | `tlr` | Remove a file named `tlr`. |
83+
| `fs/vdsk` | `3` | `tlr` | Check if a file named `tlr` exists. |
84+
| `fs/vdsk` | `4` | `tlr` | Create a directory or advance into that directory, go back with `..`. |
85+
| `fs/vdsk` | `5` | `tlr` | Reads a file named in `tlr` and stores the data in `tlr`. |
86+
| `fs/vdsk` | `6` | `tlr`, `stl` | Opens a file named in `tlr` and stores the data stored in `stl` into the file. |
87+
| `fs/vdsk` | `7` | `tlr`, `stl` | Reads a file named in `tlr` and appends the data stored in `stl` into the file. |
88+
| `fs/vdsk` | `8` | `tlr` | Reads a file named in `tlr` and prints the contents of the file. |
8189

8290
## `int`
8391
This instruction is used to directly talk to the system.

src/sys_boot__.cpp

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,16 +33,19 @@ namespace newasm::bootloader
3333
{
3434
int __main__(int argc, char* argv[])
3535
{
36-
auto& dsk = NewASM::hardware::Disk;
37-
NewASM::Drivers::FileSystem_V::DEFRAG(dsk);
38-
if(!NewASM::Drivers::FileSystem_V::EXISTS(dsk, "hi.txt"))
36+
if(false)
3937
{
40-
NewASM::Drivers::FileSystem_V::MKFILE(dsk, "hi.txt", "Lmao");
38+
auto& dsk = NewASM::hardware::Disk;
39+
NewASM::Drivers::FileSystem_V::DEFRAG(dsk);
40+
if(!NewASM::Drivers::FileSystem_V::EXISTS(dsk, "hi.txt"))
41+
{
42+
NewASM::Drivers::FileSystem_V::MKFILE(dsk, "hi.txt", "Lmao");
43+
}
44+
NewASM::Drivers::FileSystem_V::APPTOFILE(dsk, "hi.txt", "Hello!\n");
45+
auto content = NewASM::Drivers::FileSystem_V::READFILE(dsk, "hi.txt");
46+
std::cout << content;
4147
}
42-
NewASM::Drivers::FileSystem_V::APPTOFILE(dsk, "hi.txt", "Hello!\n");
43-
auto content = NewASM::Drivers::FileSystem_V::READFILE(dsk, "hi.txt");
44-
std::cout << content;
45-
48+
4649
newasm::sealedLabels = &newasm::compiler::data::sealed_labels;
4750
$defer //BC++ feature, $ blocks
4851
newasm::GLOBAL::cleanup();

0 commit comments

Comments
 (0)