2024-06-01 13:03:01 +00:00
|
|
|
%import textio
|
2024-08-23 17:33:20 +00:00
|
|
|
|
2024-07-15 22:25:29 +00:00
|
|
|
%zeropage basicsafe
|
2023-12-31 00:02:33 +00:00
|
|
|
|
2024-01-07 17:48:18 +00:00
|
|
|
main {
|
2024-08-24 12:34:23 +00:00
|
|
|
sub start() {
|
2024-09-05 23:46:22 +00:00
|
|
|
uword active_world = memory("world", 80*50, 0)
|
2024-09-06 14:14:10 +00:00
|
|
|
uword @shared cell_off = 500
|
|
|
|
uword @shared cell_off_1 = cell_off+1
|
2024-09-05 23:46:22 +00:00
|
|
|
const uword STRIDE = 40
|
|
|
|
sys.memset(active_world, 80*50, 1)
|
2024-09-06 14:14:10 +00:00
|
|
|
|
|
|
|
txt.print_ub(active_world[500] + active_world[501]) ; TODO prints 1, must be 2
|
|
|
|
txt.nl()
|
|
|
|
txt.print_ub(active_world[cell_off] + active_world[cell_off_1]) ; TODO prints 1, must be 2
|
|
|
|
txt.nl()
|
2024-09-05 23:46:22 +00:00
|
|
|
txt.print_ub(count()) ; TODO prints 1, must be 8
|
2024-09-06 14:14:10 +00:00
|
|
|
txt.nl()
|
2024-09-05 23:46:22 +00:00
|
|
|
|
|
|
|
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-09-05 19:23:17 +00:00
|
|
|
}
|
2024-07-21 11:35:28 +00:00
|
|
|
}
|
|
|
|
}
|