Final (for now) cleanup of the example sources.
Chris Pressey
3 years ago
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 | |
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 |
|
0 | 3 |
buffer[2048] buf
|
1 | 4 |
pointer ptr @ 254
|
2 | 5 |
byte foo
|
|
4 | 7 |
define main routine
|
5 | 8 |
inputs buf
|
6 | 9 |
outputs buf, y, foo
|
7 | |
trashes a, z, n, ptr
|
|
10 |
trashes a, z, n, c, ptr
|
8 | 11 |
{
|
9 | 12 |
ld y, 0
|
10 | 13 |
copy ^buf, ptr
|
11 | 14 |
copy 123, [ptr] + y
|
12 | 15 |
copy [ptr] + y, foo
|
13 | 16 |
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 |
}
|
14 | 29 |
}
|
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 |
|
0 | 3 |
byte lives
|
1 | 4 |
|
2 | 5 |
byte table[16] hexchars : "0123456789ABCDEF"
|
|
0 |
// This program is expected to loop forever.
|
|
1 |
// Be prepared to forcibly terminate your emulator.
|
|
2 |
|
0 | 3 |
define main routine
|
1 | 4 |
trashes a, y, z, n, c
|
2 | 5 |
{
|