summaryrefslogtreecommitdiff
path: root/readme.md
blob: 56a31fe0ccd6b3787036b6af1b06c18424f5fce2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# sanctuary forth (working title)

sanctuary forth is a 64-bit subroutine threaded forth system
for amd64 linux systems.

## stack effect notation

- `a`: memory address
- `c`: one byte value
- `n`: signed integer
- `u`: unsigned integer
- `?`: boolean flag

## Glossary

the following is a list of words available in this forth. (neither of these have been implemented yet i'm just putting them here in the meantime lol)

### `dp   ( -- a )`
`dp` is a variable that contains the lowest free byte of memory in user memory.

### `here   ( -- a )`
`here` yields the address of the first available byte
in user memory.

## dictionary format

note that the string length of one byte limits a word's name to 255 characters.

| field | size |
| :---- | :--- |
| link to previous word | 8 bytes |
| flag field | 1 byte |
| string length | 1 byte |
| string | <256 bytes |
| code | variable length |

## reserved registers

the registers `r14` and `r15` are reserved for the parameter stack
and the top of stack respectively.