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:
parent
f2570729a4
commit
49bb5b578a
@ -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
|
||||
|
@ -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
|
||||
|
26
eg/rudiments/support/stdlib.60p
Normal file
26
eg/rudiments/support/stdlib.60p
Normal 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
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user