Adding a 'Hello, World!' example using stdlib and a new build
[vvhitespace] / stdlib / stdio.pvvs
CommitLineData
8bed3ccd
AT
1#ifndef VVS_STDLIB_STDIO
2#define VVS_STDLIB_STDIO
3
4@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
5@ Description:
6@ This function prints a null-terminated string from the stack.
7@ Call Stack:
8@ null-terminator (ASCII '\0')
9@ char n
10@ ...
11@ char 2
12@ char 1 <-- TOS
13@ Return Stack:
14@ <empty>
15@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
32c440bf
AT
16NSSVTSSSN | Mark: 1000 (print string from stack)
17SNS | DUP
18NTSSSSSTSSSSSSSSSSTN | BRZ > 00001000 00000001
19TNSS | Print character
20NSNTSSSN | JMP > 1000
21NSSVSSSSTSSSSSSSSSSTN | Mark: 00001000 00000001
22SNN | DROP
23NTN | RTS
24
8bed3ccd
AT
25@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
26@ Description:
27@ This function prints a null-terminated string from the heap.
28@ Call Stack:
29@ pointer to first character <-- TOS
30@ Return Stack:
31@ <empty>
32@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
32c440bf
AT
33NSSVTSSTN | Mark: 1001 (print string from heap)
34SNS | DUP
35TTT | LOAD
36SNS | DUP
37NTSSSSSTSSTSSSSSSSTN | BRZ > 00001001 00000001
38TNSS | Print character
39SSSTN | Push +1
40TSSS | ADD
41NSNTSSTN | JMP > 1001
42NSSVSSSSTSSTSSSSSSSTN | Mark: 00001001 00000001
43SNN | DROP
44SNN | DROP
45NTN | RTS
8bed3ccd
AT
46
47#endif