50 lines
1.4 KiB
Markdown
50 lines
1.4 KiB
Markdown
# Wipforth
|
|
|
|
## Building and Running
|
|
|
|
To run, first compile the WebAssembly module:
|
|
|
|
```
|
|
wat2wasm --enable-threads wipforth.wat
|
|
```
|
|
|
|
Then run the server:
|
|
|
|
```
|
|
python3 server.py
|
|
```
|
|
|
|
You should then be able to open <http://localhost:8080> in a browser
|
|
and use the system from there.
|
|
|
|
**NOTE**: The server is just a very simple instantiation of Python's
|
|
built-in `http.server` that sets the cross-origin headers required for
|
|
`SharedMemoryBuffer` use. You could use any HTTP server that sets
|
|
these headers.
|
|
|
|
## Peripherals
|
|
|
|
# Serial
|
|
|
|
| Name | Offset | Size / B | Access |
|
|
|--------|--------|----------|--------------|
|
|
| TXBUF | 0 | 32 | write |
|
|
| RXBUF | 32 | 32 | read |
|
|
| TXDATA | 64 | 1 | atomic write |
|
|
| TXHEAD | 65 | 1 | atomic read |
|
|
| TXTAIL | 66 | 1 | atomic write |
|
|
| RXDATA | 67 | 1 | atomic read |
|
|
| RXHEAD | 68 | 1 | atomic write |
|
|
| RXTAIL | 69 | 1 | atomic read |
|
|
|
|
For both sending (`TX`) and receiving (`RX`), there are four
|
|
registers: `xBUF`, `xDATA`, `xHEAD` and `xTAIL`:
|
|
|
|
- `xBUF` registers are 32-byte FIFO ring buffers used for data
|
|
- The `xDATA` registers indicate whether data is available (0 for
|
|
data, FFh for no data)
|
|
- The `xHEAD` and `xTAIL` registers specify the start and end of
|
|
data in the FIFO, `xHEAD` being the offset of the first byte of
|
|
data, and `xTAIL` being the offset of the first byte after the
|
|
data.
|