Commit | Line | Data |
---|---|---|
92a92075 AT |
1 | # Overview # |
2 | ||
3 | This folder contains a library of useful functions written in VVhitespace. | |
4 | Standard include guards are used with `cpp` to include the stdlib in user | |
5 | programs. For an example, see `examples/hello-stdlib`. | |
6 | ||
32c440bf AT |
7 | # Reservations # |
8 | ||
92a92075 AT |
9 | Since all labels share a global namespace, the standard library makes the |
10 | following reservations: | |
11 | ||
32c440bf AT |
12 | ## Label ## |
13 | ||
14 | 00000000 0xxxxxxx - reserved for stdlib function entry points | |
15 | 00000000 1xxxxxxx - unassigned | |
16 | 0xxxxxxx xxxxxxxx - reserved for private use by stdlib | |
17 | 1xxxxxxx xxxxxxxx - available for use in user programs | |
18 | ||
19 | ## Heap ## | |
20 | ||
21 | The first 256 heap addresses are reserved when using the stdlib. | |
22 | ||
23 | # Entry Points # | |
24 | ||
25 | The following labels are entry points to stdlib functions. Read the | |
26 | header comment for each function to learn the call and return stack. | |
27 | ||
3625ff3a AT |
28 | 000xxx - reserved |
29 | 001xxx - print functions | |
30 | 1000 ----- print string from stack (stdio.pvvs) | |
31 | 1001 ----- print string from heap (stdio.pvvs) | |
32 | 1010 ----- print number from stack (stdio.pvvs) | |
33 | 010xxx - math functions | |
2612f47f | 34 | 10000 ----- random (math.pvvs) |
3625ff3a | 35 | 10001 ----- absolute value (math.pvvs) |
3695b659 AT |
36 | 011xxx - heap functions |
37 | 11000 ----- memset (heap.pvvs) | |
3d75b928 | 38 | 11001 ----- memcpy (heap.pvvs) |
d63de3fa | 39 | 11010 ----- memrand (heap.pvvs) |
3625ff3a AT |
40 | 100xxx - unassigned |
41 | 101xxx - unassigned | |
1a56830d AT |
42 | 110xxx - conversion functions |
43 | 111xxx - debug functions | |
44 | 111000 ----- dump heap (debug.pvvs) | |
3625ff3a AT |
45 | 1xxxxxx - reserved for less common entry points |
46 | 1000000 ----- print sign of number (stdio.pvvs) | |
47 | 1000001 ----- print magnitude of number (stdio.pvvs) | |
32c440bf AT |
48 | |
49 | # Misc # | |
50 | ||
51 | By convention, each public stdlib label will have 8 bits of | |
52 | private label space associated with it, formed as follows: | |
53 | ||
54 | 00001000 xxxxxxxx - for use by 1000 | |
55 | 00001001 xxxxxxxx - for use by 1001 | |
92a92075 | 56 | ...etc |