Extract utility routine to "support/stdlib.60p" source.
Chris Pressey
3 years ago
0 | |
// Include `support/${PLATFORM}.60p` before this source
|
|
0 |
// Include `support/${PLATFORM}.60p` and `support/stdlib.60p` before this source
|
1 | 1 |
// Should print 01
|
2 | 2 |
|
3 | 3 |
byte lives
|
4 | |
|
5 | |
byte table[16] hexchars : "0123456789ABCDEF"
|
6 | |
|
7 | |
define prbyte routine
|
8 | |
inputs a, hexchars
|
9 | |
trashes a, z, n, c, v
|
10 | |
{
|
11 | |
save x {
|
12 | |
save a {
|
13 | |
st off, c
|
14 | |
shr a
|
15 | |
shr a
|
16 | |
shr a
|
17 | |
shr a
|
18 | |
and a, 15
|
19 | |
ld x, a
|
20 | |
ld a, hexchars + x
|
21 | |
call chrout
|
22 | |
}
|
23 | |
save a {
|
24 | |
and a, 15
|
25 | |
ld x, a
|
26 | |
ld a, hexchars + x
|
27 | |
call chrout
|
28 | |
}
|
29 | |
}
|
30 | |
}
|
31 | 4 |
|
32 | 5 |
define main routine
|
33 | 6 |
inputs lives, hexchars
|
29 | 29 |
### do it ###
|
30 | 30 |
|
31 | 31 |
out=/tmp/a-out.prg
|
32 | |
../../bin/sixtypical --traceback --output-format=$output_format support/$arch.60p $src --output $out || exit 1
|
|
32 |
../../bin/sixtypical --traceback --output-format=$output_format support/$arch.60p support/stdlib.60p $src --output $out || exit 1
|
33 | 33 |
ls -la $out
|
34 | 34 |
$emu $out
|
35 | 35 |
rm -f $out
|
|
0 |
byte table[16] hexchars : "0123456789ABCDEF"
|
|
1 |
|
|
2 |
define prbyte routine
|
|
3 |
inputs a, hexchars
|
|
4 |
trashes a, z, n, c, v
|
|
5 |
{
|
|
6 |
save x {
|
|
7 |
save a {
|
|
8 |
st off, c
|
|
9 |
shr a
|
|
10 |
shr a
|
|
11 |
shr a
|
|
12 |
shr a
|
|
13 |
and a, 15
|
|
14 |
ld x, a
|
|
15 |
ld a, hexchars + x
|
|
16 |
call chrout
|
|
17 |
}
|
|
18 |
save a {
|
|
19 |
and a, 15
|
|
20 |
ld x, a
|
|
21 |
ld a, hexchars + x
|
|
22 |
call chrout
|
|
23 |
}
|
|
24 |
}
|
|
25 |
}
|