1
0
mirror of https://github.com/catseye/SixtyPical.git synced 2025-04-04 04:29:35 +00:00

Move towards greater platform-agnosticism in these examples.

This commit is contained in:
Chris Pressey 2018-12-11 17:55:08 +00:00
parent 3a4c2e46c1
commit d3f730cc76
17 changed files with 49 additions and 123 deletions

View File

@ -4,10 +4,18 @@ the rudiments of SixtyPical.
Examples that are meant to fail and produce an error message
are in the `errorful/` subdirectory.
They are not meant to be specific to any architecture, but
many do assume the existence of a routine at 65490 which
outputs the value of the accumulator as an ASCII character,
These files are intended to be architecture-agnostic.
For the ones that do produce output, an appropriate source
under `platform/`, should be included first, like
sixtypical platform/c64.60p vector-table.60p
so that system entry points such as `chrout` are defined.
`chrout` is a routine with outputs the value of the accumulator
as an ASCII character, disturbing none of the other registers,
simply for the purposes of producing some observable output.
(This is an address of a KERNAL routine which does this
on both the Commodore 64 and the Commodore VIC-20, so these
sources should be usable on these architectures.)
(There is a KERNAL routine which does this on both the
Commodore 64 and the Commodore VIC-20. It should not be hard
to find or write such a routine for most other architectures.)

View File

@ -1,7 +1,5 @@
define chrout routine
inputs a
trashes a
@ 65490
// Include `support/${PLATFORM}.60p` before this source
// Should print ???
define print routine
trashes a, z, n

View File

@ -1,12 +1,8 @@
// Include `support/${PLATFORM}.60p` before this source
// Should print ENGGL
byte b
define chrout routine
inputs a
trashes a
@ 65490
define main routine
outputs b
trashes a, x, y, z, n, c, v

View File

@ -1,13 +1,9 @@
// Include `support/${PLATFORM}.60p` before this source
// Should print ENGGL
word w1
word w2
define chrout routine
inputs a
trashes a
@ 65490
define main routine
outputs w1, w2
trashes a, x, y, z, n, c, v

View File

@ -1,7 +1,6 @@
define chrout routine
inputs a
trashes a
@ 65490
// Demonstrates vector tables.
// Include `support/${PLATFORM}.60p` before this source
// Should print ???
define main routine
trashes a, x, y, z, n, c, v

View File

@ -1,7 +1,5 @@
define chrout routine
inputs a
trashes a
@ 65490
// Include `support/${PLATFORM}.60p` before this source
// Should print ???
define main routine
trashes a, x, y, z, n, c, v

View File

@ -1,7 +1,5 @@
define chrout routine
inputs a
trashes a
@ 65490
// Include `support/${PLATFORM}.60p` before this source
// Should print ???
define bar routine trashes a, z, n {
ld a, 66

View File

@ -1,7 +1,5 @@
define chrout routine
inputs a
trashes a
@ 65490
// Include `support/${PLATFORM}.60p` before this source
// Should print ???
define main routine
trashes a, y, z, n, c

View File

@ -1,9 +1,7 @@
byte foo
// Include `support/${PLATFORM}.60p` before this source
// Should print ???
define chrout routine
inputs a
trashes a
@ 65490
byte foo
define print routine
inputs foo

View File

@ -1,22 +0,0 @@
// 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
}

View File

@ -1,7 +1,5 @@
define chrout routine
inputs a
trashes a
@ 65490
// Include `support/${PLATFORM}.60p` before this source
// Should print A
define main routine
inputs a

View File

@ -0,0 +1,6 @@
// Implementation of `chrout` for the Commodore 64 platform.
define chrout routine
inputs a
trashes a
@ 65490

View File

@ -0,0 +1,6 @@
// Implementation of `chrout` for the Commodore VIC-20 platform.
define chrout routine
inputs a
trashes a
@ 65490

View File

@ -1,21 +0,0 @@
// This will not compile on its own, because there is no `main`.
// But this and `vector-main.60p` together will compile.
define chrout routine
inputs a
trashes a
@ 65490
define printa routine
trashes a, z, n
{
ld a, 65
call chrout
}
define printb routine
trashes a, z, n
{
ld a, 66
call chrout
}

View File

@ -1,22 +0,0 @@
// This will not compile on its own, because `printa` and `printb` are not defined.
// But `vector-inc.60p` and this together will compile.
vector routine
trashes a, z, n
print
// routine printb
// trashes a, z, n
// {
// ld a, 66
// call chrout
// }
define main routine
trashes print, a, z, n
{
copy printa, print
call print
copy printb, print
call print
}

View File

@ -1,7 +1,6 @@
//
// Demonstrates vector tables.
// Prints "AABAB".
//
// Include `support/${PLATFORM}.60p` before this source
// Should print AABAB
vector routine
trashes a, z, n
@ -11,11 +10,6 @@ vector (routine
trashes a, z, n)
table[32] vectors
define chrout routine
inputs a
trashes a
@ 65490
define printa routine
trashes a, z, n
{

View File

@ -1,12 +1,10 @@
// Include `support/${PLATFORM}.60p` before this source
// Should print ???
vector routine
trashes a, z, n
print
define chrout routine
inputs a
trashes a
@ 65490
define printa routine
trashes a, z, n
{