You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
First `62 80 62 80` bytes (red color) is **CatCore Magic Signature** - kernel, apps, kexts all start from these bytes.
9
+
10
+
Next `02` byte (green color) is **File Type**, where `02` means it's an** .app** (**Application File**).
11
+
12
+
Next `01` byte (yellow color) is **Application Type**. Check table below to know all the application types (they also are available in `CatCore.ProcessType` variable, except the `CatCore.ProcessType.APP`):
13
+
14
+
| Number | Type |
15
+
|--------|------------|
16
+
| 0 | DUMMY |
17
+
| 1 | KERNEL |
18
+
| 3 | JAVASCRIPT |
19
+
| 4 | PYTHON |
20
+
| 5 | PHP |
21
+
| 6 | RUBY |
22
+
23
+
Next `01` byte (dark blue color) is **Application Flags** (bitfield). Check table below to know all the bitfield flags:
24
+
25
+
| Flag | Name | Description |
26
+
|---------|--------|------------------------|
27
+
| 1 \<< 0 | SIGNED | Application is signed. |
28
+
29
+
If application has `SIGNED` flag, next 256 bytes (purple color) is a **Signature**.
30
+
31
+
Everything else after that (light blue color) is an **Application Manifest**, which is reversed Base64 of a JSON object. JSON object **doesn't** have a strict structure, the only requirement is `code` property, containing the application code itself.
Let's make your first OS, by the end of this guide you will have the following file structure:
10
+
11
+
<Files>
12
+
<Foldername="src"defaultOpen>
13
+
<Foldername="overlay-fs"defaultOpen>
14
+
<Foldername="system"defaultOpen>
15
+
<Filename="system.js" />
16
+
<Filename="logo.png" />
17
+
</Folder>
18
+
</Folder>
19
+
<Foldername="apps"defaultOpen />
20
+
<Filename="system.json" />
21
+
</Folder>
22
+
</Files>
23
+
24
+
Start by creating all the folders (but `src/apps` is optional!), and then let's make `src/system.json` file (which is, actually, optional too):
25
+
26
+
```json
27
+
{
28
+
"name": "ExampleOS",
29
+
"version": "v0.0.1",
30
+
"logo": "/system/logo.png",
31
+
"loading": "circle"
32
+
}
33
+
```
34
+
35
+
<Accordions>
36
+
<Accordiontitle="name"id="systemjson-name">
37
+
It's the name of your OS as a string, which will be the name of your executable, app window and as a `CatCore.systemName` variable inside your code. It's recommended to set this value, but the default is `"System"`.
38
+
</Accordion>
39
+
<Accordiontitle="version"id="systemjson-version">
40
+
It's the version of your OS as a string starting from `v`, which will be available as `CatCore.systemVersion` variable inside your code. It's recommended to set this value. If it's not starting from `v`, it will be automatically added (`0.0.1` --> `v0.0.1`).
41
+
</Accordion>
42
+
<Accordiontitle="logo"id="systemjson-logo">
43
+
Optional logo of your OS at boot screen and app icon. Must be a string of a **CatCore path** (check example with `overlay-fs` above).
44
+
</Accordion>
45
+
<Accordiontitle="loading"id="systemjson-loading">
46
+
Sets boot screen loader style. Must be `"circle"` or `"bar"`, defaults to `"circle"`.
47
+
Circle is similar to Windows 11 boot and bar is similar to iOS/MacOS boot.
48
+
This choice is decorative, but bar can have a progress percentage (how much % of the bar is filled), giving more information to the user.
49
+
</Accordion>
50
+
</Accordions>
51
+
52
+
Once you have made the folders, `system.json` (or decided to skip it) and logo file (optional), you need to create a file for your OS code.
53
+
54
+
OS code file must be in `/system` mount, named `system` or `sys`, and have any supported language extension. Currently supported languages: **JavaScript**, **Python**, **PHP**, **Ruby**, but this list will increase in future updates.
55
+
56
+
Once you have created the file, paste this example code:
Next, compile your first OS and open it. After some waiting, you should have a black screen - congratulations with your first OS! 🎉
84
+
85
+
<Callouttitle="Troubleshooting">
86
+
If you have some issues and do not get a black screen, press `Ctrl + Shift + F8` inside your OS, even while it's booting. There's a great chance a **logs panel** will open up containing enough information to fix problems. If you still can't get your first OS to work, contact CatCore support using [Discord](https://discord.gg/AU5PBWxeVN) or [GitHub](https://github.com/CatCoreV).
87
+
</Callout>
88
+
89
+
For future development, you may use some IDE that can speed up your OS development. I recommend **VSCode**, as it's the only one tested with **CatCore**. To use IDE integration, just open `os-compiler` folder in your IDE and if your IDE supports it, it will automatically pick-up all the needed files. You might need to compile at least 1 time for IDE integration to work properly. If you're using **JavaScript**, your IDE might not like top-level `await`, even though it's supported - we can't fix this issue, so you'll have to just add an async wrapper.
90
+
91
+
And lastly, you should learn how to control the bootscreen:
// Without an argument, it completely ends the boot and hides the boot screen
105
+
CatCore.loadProgress();
106
+
```
107
+
</Tab>
108
+
<Tabvalue="Python">
109
+
```python
110
+
import asyncio
111
+
112
+
asyncdefmain():
113
+
# Loop from 1% to 100%
114
+
for i inrange(1, 101):
115
+
# Set the loading progress
116
+
CatCore.loadProgress(i)
117
+
# Wait 0.1 seconds
118
+
await CatCore.delay(0.1*CatCore.SECOND)
119
+
120
+
# Without an argument, it completely ends the boot and hides the boot screen
121
+
CatCore.loadProgress()
122
+
123
+
asyncio.run(main())
124
+
```
125
+
</Tab>
126
+
<Tabvalue="PHP">
127
+
```php
128
+
<?php
129
+
// Loop from 1% to 100%
130
+
for (var i = 1; i <= 100; i++) {
131
+
// Set the loading progress
132
+
$CatCore->loadProgress(i);
133
+
// Wait 0.1 seconds
134
+
await $CatCore->delay(0.1 *CatCore.SECOND);
135
+
}
136
+
137
+
// Without an argument, it completely ends the boot and hides the boot screen
138
+
$CatCore->loadProgress();
139
+
?>
140
+
```
141
+
</Tab>
142
+
<Tabvalue="Ruby">
143
+
```ruby
144
+
# Loop from 1% to 100%
145
+
(1..100).each do |i|
146
+
# Set the loading progress
147
+
CatCore.loadProgress(i)
148
+
# Wait 0.1 seconds
149
+
await CatCore.delay(0.1*CatCore::SECOND)
150
+
end
151
+
152
+
# Without an argument, it completely ends the boot and hides the boot screen
153
+
CatCore.loadProgress()
154
+
```
155
+
</Tab>
156
+
</Tabs>
157
+
158
+
<Callouttitle="Did not understand?">
159
+
If you have trouble understanding the code, you probably **should** learn English (words like **delay** or **load progress**) or your programming language (like `for` or `await`).
160
+
In JavaScript, top-level `await` is allowed, even if your IDE does not think that.
161
+
If you're a Ruby developer, you might not know about `await`, as Ruby does not have that keyword, so you'll have to learn it like in other languages. Simple explanation of `await` is just to **wait** for that function to finish, even if it takes a long time in the background.
162
+
</Callout>
163
+
164
+
Now, that you have basic understanding of CatCore, you can make a **text-based terminal OS**, a **graphical OS**, or even both at the same time, and it's **your** choice, so choose what you want to start with:
Copy file name to clipboardExpand all lines: content/docs/en/getting-started.mdx
+3-1Lines changed: 3 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -80,7 +80,9 @@ First I would recommend to learn about all the compiler buttons:
80
80
New **Quick** mode allows you to use cache of previous compilation to highly speed up the next one.
81
81
Since you just opened the compiler, it's **locked**, but once you'll do a compilation, it will unlock.
82
82
Note that if you change any setting (like the kernel version, architecture or target), quick compilation will lock again.
83
-
> Quick compilation is useful, but it also keeps old files in `/data` mount, which can break your OS in some rare cases, but that's your OS issue, which you probably **should** fix if it happens!
83
+
<Callouttitle="Quick compilation">
84
+
Quick compilation is useful, but it also keeps old files in `/data` mount, which can break your OS in some rare cases, but that's your OS issue, which you probably **should** fix if it happens!
85
+
</Callout>
84
86
</Accordion>
85
87
<Accordiontitle="Bottom bar"id="bottom-bar">
86
88
Bottom bar contains a status of the compilation, like **Ready!**, which displays what is currently happening.
It's a color of the background, defaults to `black`.
95
+
</Accordion>
96
+
</Accordions>
97
+
98
+
## ANSI
99
+
100
+
There's also one more function `CatCore.enableANSI`, which is a boolean. It controls whetever `CatCore.text` should parse and render ANSI escape sequences. Here's an example for you:
CatCore understands a lot of ANSI escape sequences: bold, dim/faint, italic, underline, inverted, striketrough, background and foreground colors (in 8/16/256/RGB color modes).
0 commit comments