// // Demonstrates vector tables. // Prints "AABAB". // // TODO: this doesn't pass the analyzer currently, which suggests a bug. // // RangeExceededError: Possible range of x:byte (0, 255) exceeds // acceptable range of vectors:vector table[32] (0, 31) (in main, line 57) // // (despite various attempts to work around by calling a setup routine, etc.) // It should really be able to figure out that the range of x is 0..4 there. vector routine trashes a, z, n print vector (routine trashes a, z, n) table[32] vectors 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 } define main routine inputs vectors outputs vectors trashes print, a, x, z, n, c { ld x, 0 copy printa, vectors + x inc x copy printa, print copy print, vectors + x inc x copy printb, print copy print, vectors + x inc x copy printa, vectors + x inc x copy printb, vectors + x ld x, 0 for x up to 4 { copy vectors + x, print call print } }