git @ Cat's Eye Technologies SixtyPical / 49bb5b5
Extract utility routine to "support/stdlib.60p" source. Chris Pressey 2 years ago
3 changed file(s) with 28 addition(s) and 29 deletion(s). Raw diff Collapse all Expand all
0 // Include `support/${PLATFORM}.60p` before this source
0 // Include `support/${PLATFORM}.60p` and `support/stdlib.60p` before this source
11 // Should print 01
22
33 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 }
314
325 define main routine
336 inputs lives, hexchars
2929 ### do it ###
3030
3131 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
3333 ls -la $out
3434 $emu $out
3535 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 }