Skip to content

Commit b709413

Browse files
committed
Update README
1 parent d66f9cd commit b709413

File tree

3 files changed

+81
-41
lines changed

3 files changed

+81
-41
lines changed

README.md

Lines changed: 81 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,17 @@
11
# Silicon8
22

33
Silicon8 is an implementation of a runtime for Chip-8, SCHIP and XO-Chip in Go
4-
that can run as a standard Go module, or be compiled to WebAssembly with TinyGo.
5-
Please note that it is currently a work in progress, and far from perfect.
4+
that can be used in Go projects or it can be compiled to WebAssembly so it can
5+
run in your web browser (or anywhere WebAssembly can run).
66

7-
This is my first experiment with WebAssembly and with Go. So I'll probably look
8-
back on this repository with shame in a very short amount of time 😉 But that's
9-
the point of this, this is a learning project for me.
10-
11-
## Developer instructions
12-
13-
### How to run
7+
To try it running in your browser, visit https://timendus.github.io/silicon8/
8+
and load a CHIP-8 ROM file.
149

15-
To try it running in your browser, visit https://timendus.github.io/silicon8/ and drag a CHIP-8 ROM file onto the monitor.
10+
Please note that it is not perfect, and you may run into some bugs. Especially when the auto-detection fails to detect SCHIP and XO-CHIP programs. More about that [below](#august-2021).
1611

17-
In the console, using NodeJS:
18-
19-
```bash
20-
git clone [email protected]:Timendus/silicon8.git
21-
cd silicon8
22-
./run.js ./tests/abc.ch8 # Should run the interpreter with a given CHIP-8 binary
23-
```
24-
25-
Key `Q` or `Ctrl+C` exits the interpreter.
26-
27-
### How to serve the website
28-
29-
```bash
30-
npm install
31-
npm run serve # Should serve the web version on localhost:8080
32-
```
33-
34-
### How to build
35-
36-
```bash
37-
brew install tinygo # Or use your own favourite package manager
38-
npm run build # Should rebuild the WebAssembly Go module
39-
```
40-
41-
### How to test
42-
43-
```bash
44-
npm install
45-
npm test # Should run the tests
46-
```
12+
This is my first experiment with both WebAssembly and Go. So I'll probably look
13+
back on this repository with shame in a very short amount of time 😉 But that's
14+
the point of this, this is a learning project for me.
4715

4816
## Development log
4917

@@ -74,6 +42,8 @@ present, so I decided to start writing some automated tests. After about a week
7442
of writing tests and fixing bugs here and there, on and off, I think I now feel
7543
kind of safe saying that the interpreter works as it should for CHIP-8.
7644

45+
![Space Invaders by David Winter, although that has a bug in and of itself](console.png)
46+
7747
Also, I added a web-based front-end for the interpreter that works nicer and
7848
looks better than the console based version.
7949

@@ -97,6 +67,75 @@ still expect to be run on SCHIP with all the quirks of that platform, for
9767
example. Same with developers writing programs for XO-CHIP without actually
9868
using anything beyond CHIP-8 and SCHIP instructions. No way to tell.
9969

70+
### Second half of August 2021
71+
72+
After doing a pretty big refactor, the host environment now just has to call the
73+
`clockTick` function 60 times per second, and it will get a callback with the
74+
new image to display when the screen has been updated. This is a much cleaner
75+
solution that doesn't require as much knowledge of the interpreter internals on
76+
the host side.
77+
78+
Also, as mentioned above, the image that the host environment receives is now a
79+
colour image (three bytes per pixel), which has allowed me to more easily
80+
implement XO-CHIPs four colour mode. Beyond that, I added the option to draw 16
81+
colours to the screen using four planes. [John
82+
Earnest](https://github.com/JohnEarnest) mentions this posibility in [his
83+
proposal for XO-CHIP](https://github.com/JohnEarnest/Octo/blob/gh-pages/docs/XO-ChipSpecification.md),
84+
but Octo doesn't implement it:
85+
86+
> Encoding is chosen such that it would be possible to provide 4 bitplanes (and
87+
> thus 16 colors!) in the future should it prove necessary.
88+
89+
Although I'm not quire sure I would call it necessary, it's certainly cool.
90+
91+
![Showing 16 colours in Silicon8](colours.png)
92+
93+
To properly test all the display stuff I added two expectations to Jest that
94+
allow me to capture the contents of the display in a BMP file, and then test
95+
against that file. This allows for easy and quick visual inspection to see if
96+
the test results in the right image, and to be alerted when anything breaks
97+
that.
98+
99+
Finally, I made ["Pixel Studio"](https://timendus.github.io/silicon8/pixel-studio/)
100+
to convert images to sprite data in a what-you-see-is-what-you-get type of way.
101+
It supports one through four planes of colour, all possible sprite sizes and
102+
optional dithering.
103+
104+
## Developer instructions
105+
106+
### How to run
107+
108+
In the console, using NodeJS:
109+
110+
```bash
111+
git clone [email protected]:Timendus/silicon8.git
112+
cd silicon8
113+
./run.js ./tests/abc.ch8 # Should run the interpreter with a given CHIP-8 binary
114+
```
115+
116+
Key `Q` or `Ctrl+C` exits the interpreter.
117+
118+
### How to serve the website
119+
120+
```bash
121+
npm install
122+
npm run serve # Should serve the web version on localhost:8080
123+
```
124+
125+
### How to build
126+
127+
```bash
128+
brew install tinygo # Or use your own favourite package manager
129+
npm run build # Should rebuild the WebAssembly Go module
130+
```
131+
132+
### How to test
133+
134+
```bash
135+
npm install
136+
npm test # Should run the tests
137+
```
138+
100139
## TODO
101140

102141
In no particular order 😉
@@ -106,5 +145,6 @@ interpreter type
106145
* [ ] Write more tests for SCHIP and XO-CHIP instructions
107146
* [ ] Rewrite scroll routines to scroll selected plane(s)
108147
* [ ] Re-implement clipQuirk in draw function
109-
* [ ] Properly skip over i := long 0xNNNN
148+
* [ ] Properly skip over `i := long 0xNNNN`
110149
* [ ] Implement XO-CHIP's `audio`
150+
* [ ] Fix exception when input image doesn't align with sprite size in Pixel Studio

colours.png

1.19 MB
Loading

console.png

19 KB
Loading

0 commit comments

Comments
 (0)