git @ Cat's Eye Technologies SixtyPical / 1116229
Clean up example programs a little bit. Chris Pressey 3 years ago
3 changed file(s) with 30 addition(s) and 59 deletion(s). Raw diff Collapse all Expand all
0 // SixtyPical 0.11 introduced a new syntax for defining routines
1 // (routine was made into a type, and you can now say: define name type.)
2
3 typedef routine
4 inputs x
5 outputs x
6 trashes z, n
7 routine_type
8
9 vector routine_type vec
10
11 define foo routine_type
12 {
13 inc x
14 }
15
16 define main routine
17 outputs vec
18 trashes a, z, n
19 {
20 copy foo, vec
21 }
0 //
1 // Demonstrates vector tables.
2 // Prints "AABAB".
3 //
4
05 vector routine
16 trashes a, z, n
27 print
3035 trashes print, a, x, z, n, c
3136 {
3237 ld x, 0
33 copy printa, print
34 copy print, vectors + x
38 copy printa, vectors + x
3539 inc x
3640 copy printa, print
3741 copy print, vectors + x
3943 copy printb, print
4044 copy print, vectors + x
4145 inc x
42 copy printa, print
43 copy print, vectors + x
46 copy printa, vectors + x
4447 inc x
45 copy printb, print
46 copy print, vectors + x
47
48 copy printa, print
48 copy printb, vectors + x
4949
5050 ld x, 0
5151 repeat {
+0
-51
eg/vector-table2.60p less more
0 vector routine
1 trashes a, z, n
2 print
3
4 vector (routine
5 trashes a, z, n)
6 table[32] vectors
7
8 routine chrout
9 inputs a
10 trashes a
11 @ 65490
12
13 routine printa
14 trashes a, z, n
15 {
16 ld a, 65
17 call chrout
18 }
19
20 routine printb
21 trashes a, z, n
22 {
23 ld a, 66
24 call chrout
25 }
26
27 routine main
28 inputs vectors
29 outputs vectors
30 trashes print, a, x, z, n, c
31 {
32 ld x, 0
33 copy printa, vectors + x
34 inc x
35 copy printa, vectors + x
36 inc x
37 copy printb, vectors + x
38 inc x
39 copy printa, vectors + x
40 inc x
41 copy printb, vectors + x
42
43 ld x, 0
44 repeat {
45 copy vectors + x, print
46 call print
47 inc x
48 cmp x, 5
49 } until z
50 }