1
0
mirror of https://github.com/catseye/SixtyPical.git synced 2024-11-22 01:32:13 +00:00

Extract utility routine to "support/stdlib.60p" source.

This commit is contained in:
Chris Pressey 2018-12-25 18:10:58 +00:00
parent f2570729a4
commit 49bb5b578a
3 changed files with 28 additions and 29 deletions

View File

@ -1,35 +1,8 @@
// Include `support/${PLATFORM}.60p` before this source
// Include `support/${PLATFORM}.60p` and `support/stdlib.60p` before this source
// Should print 01
byte lives
byte table[16] hexchars : "0123456789ABCDEF"
define prbyte routine
inputs a, hexchars
trashes a, z, n, c, v
{
save x {
save a {
st off, c
shr a
shr a
shr a
shr a
and a, 15
ld x, a
ld a, hexchars + x
call chrout
}
save a {
and a, 15
ld x, a
ld a, hexchars + x
call chrout
}
}
}
define main routine
inputs lives, hexchars
outputs lives

View File

@ -30,7 +30,7 @@ fi
### do it ###
out=/tmp/a-out.prg
../../bin/sixtypical --traceback --output-format=$output_format support/$arch.60p $src --output $out || exit 1
../../bin/sixtypical --traceback --output-format=$output_format support/$arch.60p support/stdlib.60p $src --output $out || exit 1
ls -la $out
$emu $out
rm -f $out

View File

@ -0,0 +1,26 @@
byte table[16] hexchars : "0123456789ABCDEF"
define prbyte routine
inputs a, hexchars
trashes a, z, n, c, v
{
save x {
save a {
st off, c
shr a
shr a
shr a
shr a
and a, 15
ld x, a
ld a, hexchars + x
call chrout
}
save a {
and a, 15
ld x, a
ld a, hexchars + x
call chrout
}
}
}