Sixtypical Compilation ====================== This is a test suite, written in [Falderal][] format, for compiling Sixtypical to 6502 machine code. [Falderal]: http://catseye.tc/node/Falderal -> Functionality "Compile Sixtypical program" is implemented by -> shell command "bin/sixtypical --compile %(test-body-file) | fa-bin-to-hex" -> Tests for functionality "Compile Sixtypical program" Null program. | routine main | { | } = 00c060 Rudimentary program. | routine main | inputs a | outputs a | trashes c, z, n, v | { | st off, c | add a, 4 | } = 00c018690460 Call extern. | routine chrout | inputs a | trashes a | @ 65490 | | routine main | inputs a | trashes a, z, n | { | ld a, 65 | call chrout | } = 00c0a94120d2ff60 Call defined routine. | routine foo | outputs a, x, y | trashes z, n | { | ld a, 0 | ld x, 0 | ld y, 0 | } | | routine main | trashes a, x, y, z, n | { | call foo | } = 00c02004c060a900a200a00060 Access a defined memory location. | byte foo | | routine main | trashes a, y, z, n, foo | { | ld y, 0 | st y, foo | ld a, foo | } = 00c0a0008c09c0ad09c060 Some instructions. | byte foo | | routine main | trashes a, x, y, z, n, c, v, foo | { | ld a, 0 | ld x, 0 | ld y, 0 | st a, foo | st x, foo | st y, foo | st on, c | st off, c | add a, 1 | add a, foo | sub a, 1 | sub a, foo | inc foo | inc x | inc y | dec foo | dec x | dec y | and a, 255 | and a, foo | or a, 255 | or a, foo | xor a, 255 | xor a, foo | cmp a, 1 | cmp a, foo | cmp x, 1 | cmp x, foo | cmp y, 1 | cmp y, foo | shl a | shr a | } = 00c0a900a200a0008d46c08e46c08c46c0381869016d46c0e901ed46c0ee46c0e8c8ce46c0ca8829ff2d46c009ff0d46c049ff4d46c0c901cd46c0e001ec46c0c001cc46c02a6a60 Compiling `if`. | routine main | trashes a, x, y, z, n, c, v | { | ld a, 0 | if z { | ld y, 1 | } else { | ld y, 2 | } | } = 00c0a900d005a0014c0bc0a00260 Compiling `if` without `else`. | routine main | trashes a, x, y, z, n, c, v | { | ld a, 0 | if z { | ld y, 1 | } | } = 00c0a900d005a0014c0bc0a00260