aboutsummaryrefslogtreecommitdiff
path: root/sts/common/print.sts
blob: a3bea56bfca8dcf028146da9ad45a9d039746d67 (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
defword get_hex
    f and
    dup 9 > if
        a - 'a' +
    else
        '0' +
    fi
exit

defword print_hex
    dup 1c shr get_hex sys_write
    dup 18 shr get_hex sys_write
    dup 14 shr get_hex sys_write
    dup 10 shr get_hex sys_write
    dup c shr get_hex sys_write
    dup 8 shr get_hex sys_write
    dup 4 shr get_hex sys_write
    get_hex sys_write
exit

defword print_stack
    dup
    do
        over over - 2 + get print_hex
    1 - dup 0 = until
        space sys_write
    od newline sys_write
    drop
    drop
exit