git @ Cat's Eye Technologies SixtyPical / f257072
Final (for now) cleanup of the example sources. Chris Pressey 2 years ago
7 changed file(s) with 58 addition(s) and 28 deletion(s). Raw diff Collapse all Expand all
+0
-8
eg/rudiments/add-pass.60p less more
0 define main routine
1 inputs a
2 outputs a
3 trashes c, z, n, v
4 {
5 st off, c
6 add a, 4
7 }
+0
-9
eg/rudiments/add-word.60p less more
0 word score
1 define main routine
2 inputs score
3 outputs score
4 trashes a, c, z, v, n
5 {
6 st off, c
7 add score, 1999
8 }
0 // Include `support/${PLATFORM}.60p` before this source
1 // Should print YY
2
3 word score
4
5 define main routine
6 inputs a, score
7 outputs score
8 trashes a, c, z, n, v
9 {
10 ld a, 3
11 st off, c
12 add a, 4
13
14 cmp a, 7
15 if z {
16 ld a, 89
17 call chrout
18 } else {
19 ld a, 78
20 call chrout
21 }
22
23 copy 999, score
24 st off, c
25 add score, 1999
26
27 cmp score, 2998
28 if z {
29 ld a, 89
30 call chrout
31 } else {
32 ld a, 78
33 call chrout
34 }
35 }
0 // Include `support/${PLATFORM}.60p` before this source
1 // Should print Y
2
03 buffer[2048] buf
14 pointer ptr @ 254
25 byte foo
47 define main routine
58 inputs buf
69 outputs buf, y, foo
7 trashes a, z, n, ptr
10 trashes a, z, n, c, ptr
811 {
912 ld y, 0
1013 copy ^buf, ptr
1114 copy 123, [ptr] + y
1215 copy [ptr] + y, foo
1316 copy foo, [ptr] + y
17
18 // TODO: support saying `cmp foo, 123`, maybe
19 ld a, foo
20 cmp a, 123
21
22 if z {
23 ld a, 89
24 call chrout
25 } else {
26 ld a, 78
27 call chrout
28 }
1429 }
+0
-10
eg/rudiments/copy.60p less more
0 byte bar
1 byte baz
2
3 define main routine
4 inputs baz
5 outputs bar
6 trashes a, n, z
7 {
8 copy baz, bar
9 }
0 // Include `support/${PLATFORM}.60p` before this source
1 // Should print 01
2
03 byte lives
14
25 byte table[16] hexchars : "0123456789ABCDEF"
0 // This program is expected to loop forever.
1 // Be prepared to forcibly terminate your emulator.
2
03 define main routine
14 trashes a, y, z, n, c
25 {