prog8/examples/test.p8

20 lines
643 B
Plaintext
Raw Normal View History

2024-06-01 15:03:01 +02:00
%import textio
2024-08-23 19:33:20 +02:00
%zeropage basicsafe
main {
2024-08-24 14:34:23 +02:00
sub start() {
uword active_world = memory("world", 80*50, 0)
uword cell_off = 500
const uword STRIDE = 40
sys.memset(active_world, 80*50, 1)
txt.print_ub(count()) ; TODO prints 1, must be 8
sub count() -> ubyte {
return active_world[cell_off-STRIDE-1] + active_world[cell_off-STRIDE] + active_world[cell_off-STRIDE+1] +
active_world[cell_off-1] + active_world[cell_off+1] +
active_world[cell_off+STRIDE-1] + active_world[cell_off+STRIDE] + active_world[cell_off+STRIDE+1]
}
2024-07-21 13:35:28 +02:00
}
}