+mov ax, cx ; ax = idx
+mov bl, COLS ; bl = COLS
+div bl ; al = idx / COLS ; ah = idx % COLS
+
+mov [bp - 1], al ; row = idx / COLS
+mov [bp - 2], ah ; row = idx % COLS
+mov byte [bp - 6], 0 ; neighbours = 0
+
+mov byte [bp - 8], -1 ; i = -1
+.i: ; do {
+
+ mov byte [bp - 10], -1 ; j = -1
+.j: ; do {
+
+ ; if ((row || col) && get_state (grid, row + i, col + i) == ALIVE)
+ ; neighbours++
+
+ inc byte [bp - 10]
+ cmp byte [bp - 10], 1
+ jle .j ; } while (++j <= 1)
+
+ inc byte [bp - 8]
+ cmp byte [bp - 8], 1
+ jle .i ; } while (++i <= 1)
+
+leave