mirror of
https://github.com/catseye/SixtyPical.git
synced 2024-11-04 07:06:23 +00:00
Clean up example programs a little bit.
This commit is contained in:
parent
3bee722900
commit
1116229867
22
eg/new-style-routine.60p
Normal file
22
eg/new-style-routine.60p
Normal file
@ -0,0 +1,22 @@
|
||||
// SixtyPical 0.11 introduced a new syntax for defining routines
|
||||
// (routine was made into a type, and you can now say: define name type.)
|
||||
|
||||
typedef routine
|
||||
inputs x
|
||||
outputs x
|
||||
trashes z, n
|
||||
routine_type
|
||||
|
||||
vector routine_type vec
|
||||
|
||||
define foo routine_type
|
||||
{
|
||||
inc x
|
||||
}
|
||||
|
||||
define main routine
|
||||
outputs vec
|
||||
trashes a, z, n
|
||||
{
|
||||
copy foo, vec
|
||||
}
|
@ -1,3 +1,8 @@
|
||||
//
|
||||
// Demonstrates vector tables.
|
||||
// Prints "AABAB".
|
||||
//
|
||||
|
||||
vector routine
|
||||
trashes a, z, n
|
||||
print
|
||||
@ -31,8 +36,7 @@ routine main
|
||||
trashes print, a, x, z, n, c
|
||||
{
|
||||
ld x, 0
|
||||
copy printa, print
|
||||
copy print, vectors + x
|
||||
copy printa, vectors + x
|
||||
inc x
|
||||
copy printa, print
|
||||
copy print, vectors + x
|
||||
@ -40,13 +44,9 @@ routine main
|
||||
copy printb, print
|
||||
copy print, vectors + x
|
||||
inc x
|
||||
copy printa, print
|
||||
copy print, vectors + x
|
||||
copy printa, vectors + x
|
||||
inc x
|
||||
copy printb, print
|
||||
copy print, vectors + x
|
||||
|
||||
copy printa, print
|
||||
copy printb, vectors + x
|
||||
|
||||
ld x, 0
|
||||
repeat {
|
||||
|
@ -1,51 +0,0 @@
|
||||
vector routine
|
||||
trashes a, z, n
|
||||
print
|
||||
|
||||
vector (routine
|
||||
trashes a, z, n)
|
||||
table[32] vectors
|
||||
|
||||
routine chrout
|
||||
inputs a
|
||||
trashes a
|
||||
@ 65490
|
||||
|
||||
routine printa
|
||||
trashes a, z, n
|
||||
{
|
||||
ld a, 65
|
||||
call chrout
|
||||
}
|
||||
|
||||
routine printb
|
||||
trashes a, z, n
|
||||
{
|
||||
ld a, 66
|
||||
call chrout
|
||||
}
|
||||
|
||||
routine main
|
||||
inputs vectors
|
||||
outputs vectors
|
||||
trashes print, a, x, z, n, c
|
||||
{
|
||||
ld x, 0
|
||||
copy printa, vectors + x
|
||||
inc x
|
||||
copy printa, vectors + x
|
||||
inc x
|
||||
copy printb, vectors + x
|
||||
inc x
|
||||
copy printa, vectors + x
|
||||
inc x
|
||||
copy printb, vectors + x
|
||||
|
||||
ld x, 0
|
||||
repeat {
|
||||
copy vectors + x, print
|
||||
call print
|
||||
inc x
|
||||
cmp x, 5
|
||||
} until z
|
||||
}
|
Loading…
Reference in New Issue
Block a user