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
|
2024-09-06 15:00:24 +00:00
|
|
|
%option no_sysinit
|
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
|
|
|
|
2024-09-06 15:00:24 +00:00
|
|
|
txt.print_ub(active_world[500] + active_world[501]) ; 2
|
2024-09-06 14:14:10 +00:00
|
|
|
txt.nl()
|
2024-09-06 15:00:24 +00:00
|
|
|
txt.print_ub(active_world[cell_off] + active_world[cell_off_1]) ; 2
|
2024-09-06 14:14:10 +00:00
|
|
|
txt.nl()
|
2024-09-06 15:00:24 +00:00
|
|
|
txt.print_ub(count()) ; 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
|
|
|
}
|
|
|
|
}
|