git @ Cat's Eye Technologies SixtyPical / 0ec8970
Expand example with code that will likely become library support. Chris Pressey 2 years ago
2 changed file(s) with 38 addition(s) and 21 deletion(s). Raw diff Collapse all Expand all
00 byte lives
11
2 byte table[16] hexchars : "0123456789ABCDEF"
3
4 define prbyte routine
5 inputs a, hexchars
6 trashes a, z, n, c, v
7 {
8 save x {
9 save a {
10 st off, c
11 shr a
12 shr a
13 shr a
14 shr a
15 and a, 15
16 ld x, a
17 ld a, hexchars + x
18 call chrout
19 }
20 save a {
21 and a, 15
22 ld x, a
23 ld a, hexchars + x
24 call chrout
25 }
26 }
27 }
28
229 define main routine
3 inputs lives
30 inputs lives, hexchars
431 outputs lives
532 trashes a, x, z, n, c, v
6 {
7 ld a, 0
8 st a, lives
9 ld x, lives
10 st off, c
11 add x, 1
12 st x, lives
13 }
33 {
34 ld a, 0
35 st a, lives
36 ld x, lives
37 st off, c
38 inc x
39 st x, lives
40 ld a, lives
41 call prbyte
42 }
+0
-12
eg/rudiments/if.60p less more
0 define main routine
1 inputs a
2 outputs a
3 trashes z, n, c
4 {
5 cmp a, 42
6 if z {
7 ld a, 7
8 } else {
9 ld a, 23
10 }
11 }