git @ Cat's Eye Technologies SixtyPical / 046e43c
Add another example. Even more convincing that the order is wrong. Chris Pressey 3 years ago
3 changed file(s) with 146 addition(s) and 74 deletion(s). Raw diff Collapse all Expand all
0 // Should print ENGGL
1
2 byte b
3
4 define chrout routine
5 inputs a
6 trashes a
7 @ 65490
8
9 define main routine
10 outputs b
11 trashes a, x, y, z, n, c, v
12 {
13 ld a, 40
14 st a, b
15
16 cmp a, b
17 if z {
18 ld a, 69 // E
19 call chrout
20 } else {
21 ld a, 78 // N
22 call chrout
23 }
24
25 ld a, 41
26 st a, b
27 ld a, 40
28
29 cmp a, b
30 if z {
31 ld a, 69 // E
32 call chrout
33 } else {
34 ld a, 78 // N
35 call chrout
36 }
37
38 ld a, 20
39 st a, b
40
41 ld a, 21
42
43 cmp a, b // 21 >= 20
44 if c {
45 ld a, 71 // G
46 call chrout
47 } else {
48 ld a, 76 // L
49 call chrout
50 }
51
52 ld a, 20
53
54 cmp a, b // 20 >= 21
55 if c {
56 ld a, 71 // G
57 call chrout
58 } else {
59 ld a, 76 // L
60 call chrout
61 }
62
63 ld a, 19
64
65 cmp a, b // 19 < 21
66 if c {
67 ld a, 71 // G
68 call chrout
69 } else {
70 ld a, 76 // L
71 call chrout
72 }
73 }
0 // Should print ENGGL
1
2 word w1
3 word w2
4
5 define chrout routine
6 inputs a
7 trashes a
8 @ 65490
9
10 define main routine
11 outputs w1, w2
12 trashes a, x, y, z, n, c, v
13 {
14 copy 4000, w1
15 copy 4000, w2
16
17 cmp w1, w2
18 if z {
19 ld a, 69 // E
20 call chrout
21 } else {
22 ld a, 78 // N
23 call chrout
24 }
25
26 copy 4000, w1
27 copy 4001, w2
28
29 cmp w1, w2
30 if z {
31 ld a, 69 // E
32 call chrout
33 } else {
34 ld a, 78 // N
35 call chrout
36 }
37
38 copy 20002, w1
39 copy 20001, w2
40
41 cmp w1, w2 // 20002 >= 20001
42 if c {
43 ld a, 71 // G
44 call chrout
45 } else {
46 ld a, 76 // L
47 call chrout
48 }
49
50 copy 20001, w1
51
52 cmp w1, w2 // 20001 >= 20001
53 if c {
54 ld a, 71 // G
55 call chrout
56 } else {
57 ld a, 76 // L
58 call chrout
59 }
60
61 copy 20000, w1
62
63 cmp w1, w2 // 20000 < 20001
64 if c {
65 ld a, 71 // G
66 call chrout
67 } else {
68 ld a, 76 // L
69 call chrout
70 }
71 }
+0
-74
eg/rudiments/cmp.60p less more
0 // Should print ENLGG
1
2 word w1
3 word w2
4
5 define chrout routine
6 inputs a
7 trashes a
8 @ 65490
9
10 define main routine
11 outputs w1, w2
12 trashes a, x, y, z, n, c, v
13 {
14 copy 4000, w1
15 copy 4000, w2
16
17 cmp w1, w2
18 if z {
19 ld a, 69 // E
20 call chrout
21 } else {
22 ld a, 78 // N
23 call chrout
24 }
25
26 copy 4000, w1
27 copy 4001, w2
28
29 cmp w1, w2
30 if z {
31 ld a, 69 // E
32 call chrout
33 } else {
34 ld a, 78 // N
35 call chrout
36 }
37
38 copy 20000, w1
39 copy 20001, w2
40
41 cmp w1, w2
42 if c {
43 ld a, 71 // G
44 call chrout
45 } else {
46 ld a, 76 // L
47 call chrout
48 }
49
50 copy 20001, w1
51 copy 20001, w2
52
53 cmp w1, w2
54 if c {
55 ld a, 71 // G
56 call chrout
57 } else {
58 ld a, 76 // L
59 call chrout
60 }
61
62 copy 20002, w1
63 copy 20001, w2
64
65 cmp w1, w2
66 if c {
67 ld a, 71 // G
68 call chrout
69 } else {
70 ld a, 76 // L
71 call chrout
72 }
73 }