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