2020-12-28 14:11:20 +01:00
|
|
|
# PlanckForth: Bootstrapping Forth from Handwritten Binary
|
|
|
|
|
|
|
|
```
|
|
|
|
$ make
|
|
|
|
```
|
2020-12-28 18:16:46 +01:00
|
|
|
|
2020-12-29 06:51:27 +01:00
|
|
|
|
|
|
|
```
|
|
|
|
$ cat helloworld.fs | ./plank
|
|
|
|
```
|
|
|
|
|
2020-12-28 18:16:46 +01:00
|
|
|
# Builtin Words
|
|
|
|
|
2020-12-29 06:41:03 +01:00
|
|
|
| code | name | semantics |
|
2020-12-29 07:24:26 +01:00
|
|
|
|:----:|:---------|:------------------------------------------|
|
2020-12-29 06:41:03 +01:00
|
|
|
| Q | quit | ( -- ) Exit the process |
|
|
|
|
| C | cell | ( -- n ) The size of Cells |
|
|
|
|
| h | here | ( -- addr ) The address of 'here' cell |
|
|
|
|
| l | latest | ( -- addr ) The address of 'latest' cell |
|
|
|
|
| k | key | ( -- n ) Read character |
|
|
|
|
| t | type | ( n -- ) Print character |
|
|
|
|
| j | jump | ( -- ) Unconditional branch. |
|
|
|
|
| J | 0jump | ( a -- ) Jump if a == 0. |
|
2020-12-29 06:49:42 +01:00
|
|
|
| f | find | ( c -- xt ) Get execution token of c |
|
|
|
|
| x | execute | ( xt -- ... ) Run the execution token |
|
2020-12-29 07:23:38 +01:00
|
|
|
| @ | fetch | ( addr -- a ) Load value from addr |
|
2020-12-29 07:46:19 +01:00
|
|
|
| ! | store | ( a addr -- ) Store value to addr |
|
|
|
|
| ? | cfetch | ( addr -- c ) Load byte from addr |
|
|
|
|
| $ | cstore | ( c addr -- ) Store byte to addr |
|