diff --git a/eg/rudiments/add-pass.60p b/eg/rudiments/add-pass.60p deleted file mode 100644 index 4427cbc..0000000 --- a/eg/rudiments/add-pass.60p +++ /dev/null @@ -1,8 +0,0 @@ -define main routine - inputs a - outputs a - trashes c, z, n, v -{ - st off, c - add a, 4 -} diff --git a/eg/rudiments/add-word.60p b/eg/rudiments/add-word.60p deleted file mode 100644 index a3c1d86..0000000 --- a/eg/rudiments/add-word.60p +++ /dev/null @@ -1,9 +0,0 @@ -word score -define main routine - inputs score - outputs score - trashes a, c, z, v, n -{ - st off, c - add score, 1999 -} diff --git a/eg/rudiments/add.60p b/eg/rudiments/add.60p new file mode 100644 index 0000000..3c5a631 --- /dev/null +++ b/eg/rudiments/add.60p @@ -0,0 +1,36 @@ +// Include `support/${PLATFORM}.60p` before this source +// Should print YY + +word score + +define main routine + inputs a, score + outputs score + trashes a, c, z, n, v +{ + ld a, 3 + st off, c + add a, 4 + + cmp a, 7 + if z { + ld a, 89 + call chrout + } else { + ld a, 78 + call chrout + } + + copy 999, score + st off, c + add score, 1999 + + cmp score, 2998 + if z { + ld a, 89 + call chrout + } else { + ld a, 78 + call chrout + } +} diff --git a/eg/rudiments/buffer.60p b/eg/rudiments/buffer.60p index 79bc512..7772449 100644 --- a/eg/rudiments/buffer.60p +++ b/eg/rudiments/buffer.60p @@ -1,3 +1,6 @@ +// Include `support/${PLATFORM}.60p` before this source +// Should print Y + buffer[2048] buf pointer ptr @ 254 byte foo @@ -5,11 +8,23 @@ define main routine inputs buf outputs buf, y, foo - trashes a, z, n, ptr + trashes a, z, n, c, ptr { ld y, 0 copy ^buf, ptr copy 123, [ptr] + y copy [ptr] + y, foo copy foo, [ptr] + y + + // TODO: support saying `cmp foo, 123`, maybe + ld a, foo + cmp a, 123 + + if z { + ld a, 89 + call chrout + } else { + ld a, 78 + call chrout + } } diff --git a/eg/rudiments/copy.60p b/eg/rudiments/copy.60p deleted file mode 100644 index d31fd6b..0000000 --- a/eg/rudiments/copy.60p +++ /dev/null @@ -1,10 +0,0 @@ -byte bar -byte baz - -define main routine - inputs baz - outputs bar - trashes a, n, z -{ - copy baz, bar -} diff --git a/eg/rudiments/example.60p b/eg/rudiments/example.60p index 9eefa8e..8b27de6 100644 --- a/eg/rudiments/example.60p +++ b/eg/rudiments/example.60p @@ -1,3 +1,6 @@ +// Include `support/${PLATFORM}.60p` before this source +// Should print 01 + byte lives byte table[16] hexchars : "0123456789ABCDEF" diff --git a/eg/rudiments/forever.60p b/eg/rudiments/forever.60p index a9968cf..4d9bc92 100644 --- a/eg/rudiments/forever.60p +++ b/eg/rudiments/forever.60p @@ -1,3 +1,6 @@ +// This program is expected to loop forever. +// Be prepared to forcibly terminate your emulator. + define main routine trashes a, y, z, n, c {