Improved docs
This commit is contained in:
parent
635d3de67b
commit
5e80946097
28
README.md
28
README.md
|
@ -1,32 +1,26 @@
|
||||||
# Uxn
|
# Uxn
|
||||||
|
|
||||||
A stack-based VM, written in ANSI C.
|
A [stack-based VM](https://wiki.xxiivv.com/site/uxn.html), written in ANSI C.
|
||||||
|
|
||||||
## Build
|
|
||||||
|
|
||||||
```
|
|
||||||
cc uxn.c -std=c89 -Os -DNDEBUG -g0 -s -Wall -Wno-unknown-pragmas -o uxn
|
|
||||||
```
|
|
||||||
|
|
||||||
## Assembly Syntax
|
## Assembly Syntax
|
||||||
|
|
||||||
### Write
|
### Write
|
||||||
|
|
||||||
- `;variable`, set a label to an assigned address
|
- `;variable`, automatically assign an address to a label.
|
||||||
- `:const`, set a label to a constant short
|
- `:const FFCF`, manually assign an address to a label.
|
||||||
- `@label`, set a label to an address
|
- `@label`, assign the current address to a label.
|
||||||
|
|
||||||
### Read
|
### Read
|
||||||
|
|
||||||
- `,literal`, push label value to stack
|
- `,literal`, push label value to stack, prefixed with `LIT LEN`.
|
||||||
- `.pointer`, read label value
|
- `.pointer`, push label value to stack.
|
||||||
|
|
||||||
### Special
|
### Special
|
||||||
|
|
||||||
- `( comment )`, toggle parsing on/off
|
- `( comment )`, toggle parsing on/off.
|
||||||
- `|0010`, move to position in the program
|
- `|0010`, move to position in the program.
|
||||||
- `"hello`, push literal bytes for word "hello"
|
- `"hello`, push literal bytes for word "hello".
|
||||||
- `#04`, a zero-page address, equivalent to `,0004`
|
- `#04`, a zero-page address, equivalent to `,0004`.
|
||||||
|
|
||||||
### Operator modes
|
### Operator modes
|
||||||
|
|
||||||
|
@ -68,7 +62,7 @@ BRK
|
||||||
|FFFA .RESET .FRAME .ERROR
|
|FFFA .RESET .FRAME .ERROR
|
||||||
```
|
```
|
||||||
|
|
||||||
## Mission
|
## TODOs
|
||||||
|
|
||||||
### Assembler
|
### Assembler
|
||||||
|
|
||||||
|
|
2
uxn.c
2
uxn.c
|
@ -27,7 +27,7 @@ void wspush16(Uxn *u, Uint16 s) { wspush8(u,s >> 8); wspush8(u,s & 0xff); }
|
||||||
Uint16 wspop16(Uxn *u) { return wspop8(u) + (wspop8(u) << 8); }
|
Uint16 wspop16(Uxn *u) { return wspop8(u) + (wspop8(u) << 8); }
|
||||||
Uint16 wspeek16(Uxn *u, Uint8 o) { return bytes2short(u->wst.dat[u->wst.ptr - o], u->wst.dat[u->wst.ptr - o + 1]); }
|
Uint16 wspeek16(Uxn *u, Uint8 o) { return bytes2short(u->wst.dat[u->wst.ptr - o], u->wst.dat[u->wst.ptr - o + 1]); }
|
||||||
void rspush16(Uxn *u, Uint16 a) { u->rst.dat[u->rst.ptr++] = a; }
|
void rspush16(Uxn *u, Uint16 a) { u->rst.dat[u->rst.ptr++] = a; }
|
||||||
Uint16 mempeek16(Uxn *u, Uint16 s) { return (u->ram.dat[s] << 8) + (u->ram.dat[s+1] & 0xff); }
|
Uint16 mempeek16(Uxn *u, Uint16 s) { return (u->ram.dat[s] << 8) + (u->ram.dat[s + 1] & 0xff); }
|
||||||
|
|
||||||
/* I/O */
|
/* I/O */
|
||||||
void op_brk(Uxn *u) { setflag(&u->status,FLAG_HALT, 1); }
|
void op_brk(Uxn *u) { setflag(&u->status,FLAG_HALT, 1); }
|
||||||
|
|
Loading…
Reference in New Issue