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

Expand example with code that will likely become library support.

This commit is contained in:
Chris Pressey 2018-12-12 09:27:25 +00:00
parent 03a682ff08
commit 0ec8970c76
2 changed files with 38 additions and 21 deletions

View File

@ -1,14 +1,43 @@
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
inputs lives, hexchars
outputs lives
trashes a, x, z, n, c, v
{
ld a, 0
st a, lives
ld x, lives
st off, c
add x, 1
st x, lives
}
{
ld a, 0
st a, lives
ld x, lives
st off, c
inc x
st x, lives
ld a, lives
call prbyte
}

View File

@ -1,12 +0,0 @@
define main routine
inputs a
outputs a
trashes z, n, c
{
cmp a, 42
if z {
ld a, 7
} else {
ld a, 23
}
}