Skip to content

Commit 8bc2b5d

Browse files
authored
Project logo, README and code examples updates (#35)
* Rename CONTRIBUTION.md to CONTRIBUTING.md, as recommended by GitHub Docs Signed-off-by: Ivan Movchan <ivan.movchan.07@gmail.com> * New code examples! 1. Uploaded new programs: * hello-world.s - an updated "Hello World" program using string literals; * escape-sequences.s - a program demonstrating escape sequences processing by HyperCPU; * compare.s - a program demonstrating compare and conditional jump commands. 2. Renamed hello-world.s to hello-world-legacy.s. Signed-off-by: Ivan Movchan <ivan.movchan.07@gmail.com> * Update project logo Signed-off-by: Ivan Movchan <ivan.movchan.07@gmail.com> * Rewrite contributing guidelines Signed-off-by: Ivan Movchan <ivan.movchan.07@gmail.com> * Update building instructions and other stuff Signed-off-by: Ivan Movchan <ivan.movchan.07@gmail.com> * Minor changes in ROADMAP Signed-off-by: Ivan Movchan <ivan.movchan.07@gmail.com> * Hotfix: 2 spaces tabulation according to coding style guidelines Signed-off-by: Ivan Movchan <ivan.movchan.07@gmail.com> * README minor fixes Signed-off-by: Ivan Movchan <ivan.movchan.07@gmail.com> * Hotfix: remove CMake from dependencies Signed-off-by: Ivan Movchan <ivan.movchan.07@gmail.com> * Hotfix: update architecture names Signed-off-by: Ivan Movchan <ivan.movchan.07@gmail.com> --------- Signed-off-by: Ivan Movchan <ivan.movchan.07@gmail.com>
1 parent 820e4aa commit 8bc2b5d

11 files changed

Lines changed: 247 additions & 99 deletions

CONTRIBUTING.md

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# HyperCPU Contributing Guidelines
2+
3+
This file describes the contributing guidelines of the project.
4+
5+
If you are going to work with code, we strongly recommend reading [Coding style](#coding-style) section at the end of file.
6+
7+
## Project collaborators
8+
9+
Clone repository locally and create a new branch from `master` with some senseful name.
10+
11+
> [!TIP]
12+
> Ask yourself: what are you going to do? What feature are you going to implement (or what bug are you going to fix)?
13+
>
14+
> **Examples of BAD branch names:** `r0ego03rg750yt3w4p37w8ypt98bo4wy49wyeuys9o49suebs9o84y3p47304p34bt3tb5o94ba0843twp`, `vasyapupkinwashere`.
15+
>
16+
> **Examples of GOOD branch names:** `fix-zero-division-error`, `implement-windows-support`.
17+
18+
Do your work on that branch, but **do not** touch others. Every push to any branch except `master` starts a CI workflow with minimal tests.
19+
20+
When you are ready, make a pull request (PR) to `master` branch. When the PR gets created, you have to track following checks: `CodeQL`, `Codacy`, main CI workflow that runs extended tests, and the job that builds the project on multiple platforms.
21+
22+
If MentatBot tells you what can be improved, it is better that you improve it :)
23+
24+
When all CI jobs finish successfully, just wait for project owner to review and approve your work and, finally, merge your PR.
25+
26+
Voila! Your changes have been merged and accepted to the project.
27+
28+
## Contributors
29+
30+
The same stuff as for project collaborators, except that you also have to fork the repository and work there. You will probably have to disable GitHub Actions or connect the self-hosted runner (no guarantee that HyperCPU workflows will execute successfully on custom runner).
31+
32+
## Coding style
33+
34+
### Identifiers
35+
36+
Use *PascalCase* for namespaces, class names and functions; *snake_case* for local variables and class fields.
37+
38+
### Tabs
39+
40+
2 spaces long.
41+
42+
### Whitespaces
43+
44+
A single space should be between operators, and no spaces should be between parenthesis and arguments.
45+
46+
```cpp
47+
namespace HyperCPU {
48+
...
49+
}
50+
51+
class CPU {
52+
private:
53+
bool is_hypercpu_cool = true;
54+
}
55+
56+
void HyperCPU::CPU::CPU() {
57+
int magic_number = 0xDEADBEEF;
58+
std::exit(1337 * 42);
59+
}
60+
```

CONTRIBUTION.md

Lines changed: 0 additions & 12 deletions
This file was deleted.

README.md

Lines changed: 44 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,16 @@
11
<div align="center">
2-
<picture>
3-
<source media="(prefers-color-scheme: dark)" srcset="images/logo_dark.png">
4-
<source media="(prefers-color-scheme: light)" srcset="images/logo.png">
5-
<img alt="HyperCPU" src="images/logo.png">
6-
</picture>
2+
<img alt="HyperCPU" src="images/logo.png">
3+
<h1>HyperCPU</h1>
4+
<p>
5+
<a href="https://github.com/HyperWinX/HyperCPU/issues"><img src="https://img.shields.io/github/issues/HyperWinX/HyperCPU" alt="GitHub opened issues"></a>
6+
<img src="https://img.shields.io/badge/version-0.5.2-red" alt="Version">
7+
<img src="https://img.shields.io/github/actions/workflow/status/HyperWinX/HyperCPU/testing.yml?branch=dev" alt="CI status">
8+
<img src="https://img.shields.io/badge/status-in_development-red" alt="Status">
9+
<img src="https://img.shields.io/github/license/HyperWinX/HyperCPU" alt="License">
10+
<img src="https://img.shields.io/github/stars/HyperWinX/HyperCPU?color=lime" alt="Stars">
11+
</p>
712
</div>
813

9-
<h4 align="center">HyperCPU — the <i>hyper</i> toolkit for custom <i>hyper</i> ISA</h4>
10-
11-
<p align="center">
12-
<a href="https://github.com/HyperWinX/HyperCPU/issues">
13-
<img src="https://img.shields.io/github/issues/HyperWinX/HyperCPU"
14-
alt="GitHub opened issues"></a>
15-
<img src="https://img.shields.io/badge/version-0.5.2-red"
16-
alt="Version">
17-
<img src="https://img.shields.io/github/actions/workflow/status/HyperWinX/HyperCPU/testing.yml?branch=dev"
18-
alt="CI status">
19-
<img src="https://img.shields.io/badge/status-in_development-red"
20-
alt="Status">
21-
<img src="https://img.shields.io/github/license/HyperWinX/HyperCPU"
22-
alt="License">
23-
<img src="https://img.shields.io/github/stars/HyperWinX/HyperCPU?color=lime"
24-
alt="Stars">
25-
</p>
26-
27-
>[!IMPORTANT]
28-
> HyperCPU is almost ready for use! Wait for 1.0 release to try it out or build the project yourself, test it and report issues.
29-
30-
<img alt="HyperCPU screenshot" src="images/screenshot.png">
31-
32-
### What is this
33-
3414
HyperCPU is a set of programs created to work with my own simple ISA (instruction set architecture). The project was created for fun, but it took a lot of time (and nerves), and I learned a lot while working on it.
3515

3616
HyperCPU project includes:
@@ -40,10 +20,15 @@ HyperCPU project includes:
4020

4121
See [ROADMAP.md](ROADMAP.md) for project ideas and tasks.
4222

23+
>[!IMPORTANT]
24+
> HyperCPU is almost ready for use! Wait for 1.0 release to try it out or build the project yourself, test it and report issues.
25+
26+
<img alt="HyperCPU screenshot" src="images/screenshot.png">
27+
4328
### Installation
4429

4530
>[!WARNING]
46-
> HyperCPU supports 64-bit GNU/Linux systems only. It is known to be successfully built and running on `amd64` and `aarch64` architectures.
31+
> HyperCPU supports GNU/Linux systems only. It is known to be successfully built on `x86_32`, `x86_64` and `ARMv8` architectures.
4732
>
4833
> HyperCPU fails to build and/or work properly under \*BSD systems ­— please do not ask us for support of these systems. Windows support is also not planned.
4934
@@ -55,37 +40,41 @@ Pre-compiled binaries are currently not available. Sorry.
5540

5641
Building HyperCPU requires these dependencies to be installed:
5742

58-
* **C++20 compilers:** GCC 12+, Clang 14+.
59-
* **Build system:** Bazel.
60-
61-
Generating the documentation in HTML format requires Python 3 and a few modules (`python3-sphinx`, `python3-sphinx-rtd-theme`) to be installed.
43+
* GCC `>=12` or Clang `>=14`;
44+
* GNU make (required for documentation).
45+
* Bazel `>=8.2.1` (recommended using Bazelisk for installation).
46+
* Python `>=3.6` with additional modules:
47+
* `conan` (should be installed with `--break-system-packages` flag);
48+
* `sphinx` and `sphinx-rtd-theme` (required for documentation).
6249

63-
After installing dependencies run these commands in the terminal:
50+
After installing dependencies build the project by executing these commands:
6451

6552
```bash
66-
git clone --recursive https://github.com/HyperCPU-Project/HyperCPU
53+
git clone --recursive https://github.com/HyperCPU-Project/HyperCPU # Clone the repository.
6754
cd HyperCPU
68-
bazel build //src/... --config=linux-opt
69-
cd docs
70-
make html
55+
conan profile detect && conan install . --build=cmake --build=missing # Download and compile dependencies.
56+
bazel build //src/... --config=linux-opt # Build the project.
57+
ln -s bazel-bin/src/Assembler/hcasm hcasm # Make symlink to hcasm.
58+
ln -s bazel-bin/src/Emulator hcemul # Make symlink to hcemul.
7159
```
7260

73-
The compiled binaries should be located in `bazel-out` directory, and the generated documentation should be located in `docs/_build/html` directory. After building the project open `index.html` file and start reading the documentation.
61+
Building documentation should not be hard too:
7462

75-
To run the resulting binaries without searching for them in `bazel-out`, use `bazel run`.
7663
```
77-
bazel run //src/Assembler:hcasm -- <args>
78-
bazel run //src/Emulator:hcemul -- <args>
64+
cd docs
65+
make html
7966
```
8067

81-
Check out [examples](examples) folder for interesting code examples that will help you better understand the syntax of hASM and the power of HyperCPU.
68+
After building documentation open `docs/_build/html/index.html` and start reading.
8269

8370
### Usage
8471

72+
Check out [examples](examples) folder for interesting code examples that will help you better understand the syntax of hASM and the power of HyperCPU.
73+
8574
#### `hcasm` (hASM assembler)
8675

8776
```bash
88-
$ ./hcasm [-h] [--help] [--version] [-o VAR] [-c] [-V VAR] source
77+
$ ./hcasm [-h | --help] [--version] [-o VAR] [-c] [-V VAR] source
8978
```
9079

9180
* `source` — source code file to be compiled.
@@ -98,33 +87,27 @@ $ ./hcasm [-h] [--help] [--version] [-o VAR] [-c] [-V VAR] source
9887
#### `hcemul` (hCPU emulator)
9988

10089
```bash
101-
$ ./hcemul [-h] [--help] [--version] [-v VAR] [-m VAR] [--memory VAR] binary
90+
$ ./hcemul [-h | --help] [--version] [-v VAR] [-m | --memory VAR] binary
10291
```
10392

10493
* `binary` — binary file to be executed.
10594
* `-h`, `--help` — display help message and exit.
10695
* `--version` — display program version and exit.
10796
* `-v VAR` — specify verbosity level (`debug`, `info`, `warning`, `error`). Default value is `warning`.
108-
* `-m`, `--memory` — specify max. memory amount to be used. Postfixes are supported. Default value is `8K`.
97+
* `-m` (`--memory`) `VAR` — specify max. memory amount to be used. Postfixes are supported. Default value is `8K`.
10998

11099
### Contributing
111100

112-
We will be happy to hear any feedback from you. Do not hesitate to report bugs or suggest any ideas using "Issues" page.
113-
114-
Want to contribute to the project? Read [CONTRIBUTION.md](CONTRIBUTION.md) firstly.
115-
116-
Thank you for your interest in HyperCPU.
101+
See [CONTRIBUTING.md](CONTRIBUTING.md) for contributing guidelines.
117102

118103
### Authors
119104

120-
* **[HyperWin](https://github.com/HyperWinX) (2024 - present time)** — HyperCPU Project founder, lead developer and documentation author.
121-
* **[Ivan Movchan](https://github.com/ivan-movchan) (2025 - present time)** — beta tester, artist and just a contributor.
122-
* **[AshFungor](https://github.com/AshFungor) (2025 - present time)** — good contributor:)
105+
HyperCPU is brought to you by these wonderful people:
123106

124-
### License
125-
126-
HyperCPU is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
107+
* **[HyperWin](https://github.com/HyperWinX)** — project founder, lead developer and documentation author.
108+
* **[Ivan Movchan](https://github.com/ivan-movchan)** — project artist, tester, code examples author and just a contributor.
109+
* **[AshFungor](https://github.com/AshFungor)** — just a good contributor :)
127110

128-
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
111+
### License
129112

130-
You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
113+
HyperCPU is free software released under the terms of the [GNU General Public License v3.0](LICENSE).

ROADMAP.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# HyperCPU Roadmap
22

3-
This document describes the roadmap of the project (some kind of TODO-list).
3+
This file describes the roadmap of the project (some kind of TODO-list).
44

55
### *Release 1.0*
66

examples/compare.s

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
/*
2+
* This program compares 2 values in x0 and x1 registers and displays a message depending on the result of comparison.
3+
*
4+
* Written by Ivan Movchan <ivan.movchan.07@gmail.com> in 2025.
5+
*/
6+
7+
str_equal:
8+
.b8 "x0 = x1\n";
9+
.b8 0u0;
10+
11+
str_greater:
12+
.b8 "x0 > x1\n";
13+
.b8 0u0;
14+
15+
str_less:
16+
.b8 "x0 < x1\n";
17+
.b8 0u0;
18+
19+
.attr(entry) main:
20+
mov x0, 0u42;
21+
mov x1, 0x13;
22+
cmp x0, x1;
23+
jme is_equal;
24+
jmgr is_greater;
25+
jml is_less;
26+
27+
is_equal:
28+
mov x3, str_equal;
29+
jmp print;
30+
31+
is_greater:
32+
mov x3, str_greater;
33+
jmp print;
34+
35+
is_less:
36+
mov x3, str_less;
37+
jmp print;
38+
39+
print:
40+
mov xlll0, 0u0;
41+
mov xlll2, [x3];
42+
cmp xlll2, 0u0;
43+
jme print_end;
44+
write xlll0, xlll2;
45+
inc x3;
46+
jmp print;
47+
48+
print_end:
49+
halt;

examples/escape-sequences.s

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
/*
2+
* This program demonstrates how HyperCPU can handle ANSI escape sequences [1].
3+
* They can be used for displaying a colorful text or moving a cursor.
4+
* String literals are used — see hello-world.s for details.
5+
*
6+
* Written by Ivan Movchan <ivan.movchan.07@gmail.com> in 2025.
7+
*
8+
* [1] https://en.wikipedia.org/wiki/ANSI_escape_code
9+
*/
10+
11+
data:
12+
.b8 "\e[1;37m";
13+
.b8 "# # ####### ######## # #\n";
14+
.b8 "# # # # # # # #\n";
15+
.b8 "# # # # ######## ####### # ###### # # # # #\n";
16+
.b8 "# # # # # # # # ## # # # # # #\n";
17+
.b8 "######### # # # # # # # # ######## # #\n";
18+
.b8 "# # # # # # ######## # # # # #\n";
19+
.b8 "# # # # # # # # # # # #\n";
20+
.b8 "# # # # # # # # # # # # # #\n";
21+
.b8 "# # ######## ######## ####### # ####### # ####### \n";
22+
.b8 " # #\n";
23+
.b8 " # #\n";
24+
.b8 " # # #\n";
25+
.b8 " ####### #\n\n";
26+
.b8 " https://hypercpu-project.github.io/ \n";
27+
.b8 "\e[0m";
28+
.b8 0u0;
29+
30+
.attr(entry) main:
31+
mov x1, data;
32+
33+
print:
34+
mov xlll2, [x1];
35+
cmp xlll2, 0u0;
36+
jme print_end;
37+
write xlll0, xlll2;
38+
inc x1;
39+
jmp print;
40+
41+
print_end:
42+
halt;

examples/hello-world-legacy.s

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/*
2+
* This is a simple "Hello World" program written in HyperCPU assembly (hASM).
3+
* It writes a string to the console char by char, then writes a newline byte (0x10) and halts CPU.
4+
*
5+
* If you are interested in more modern (and simple?) way of displaying text in console, see hello-world.s.
6+
*
7+
* Written by Ivan Movchan <ivan.movchan.07@gmail.com> in 2025.
8+
*/
9+
10+
main:
11+
write xlll0, 'H';
12+
write xlll0, 'e';
13+
write xlll0, 'l';
14+
write xlll0, 'l';
15+
write xlll0, 'o';
16+
write xlll0, ',';
17+
write xlll0, ' ';
18+
write xlll0, 'w';
19+
write xlll0, 'o';
20+
write xlll0, 'r';
21+
write xlll0, 'l';
22+
write xlll0, 'd';
23+
write xlll0, '!';
24+
write xlll0, 0u10;
25+
halt;

examples/hello-world.s

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/*
2+
* This is another simple "Hello World" program written in HyperCPU assembly (hASM).
3+
* It writes a null-terminated string to the console using string literals and a little loop, then halts CPU.
4+
*
5+
* Before 0.4.5 version you could have to write a string char by char — see hello-world-legacy.s for details.
6+
*
7+
* Written by Ivan Movchan <ivan.movchan.07@gmail.com> in 2025.
8+
*/
9+
10+
data:
11+
.b8 "Hello, world!\n";
12+
.b8 0u0;
13+
14+
.attr(entry) main: // Program entry point.
15+
mov x1, data;
16+
17+
print:
18+
mov xlll2, [x1];
19+
cmp xlll2, 0u0; // Is NULL (0u0)?
20+
jme print_end; // Yes — go to finish.
21+
write xlll0, xlll2; // No — write data to console.
22+
inc x1;
23+
jmp print;
24+
25+
print_end:
26+
halt;

0 commit comments

Comments
 (0)