+ mov al, [bp - 1]
+ add al, [bp - 4] ; al = row + i
+
+ cmp al, ROWS ; if ((unsigned)(row + i) >= ROWS)
+ jae .continue ; continue
+
+ mov ah, [bp - 2]
+ add ah, [bp - 5] ; ah = col + j
+
+ cmp ah, COLS ; if ((unsigned)(col + j) >= COLS)
+ jae .continue ; continue
+
+ movzx bx, ah ; bx = col + j
+
+ mov ah, COLS
+ mul ah ; ax = (row + i) * COLS
+
+ add bx, ax ; bx = cell index
+ shl bx, 1 ; bx = grid offset
+
+ mov dx, [es:si + bx] ; dl = cell state
+
+ cmp dl, ALIVE ; if (!ALIVE)
+ jne .continue ; continue
+
+ inc byte [bp - 3] ; neighbours++
+
+.continue:
+ inc byte [bp - 5]
+ cmp byte [bp - 5], 1
+ jle .j ; } while (++j <= 1)
+
+ inc byte [bp - 4]
+ cmp byte [bp - 4], 1
+ jle .i ; } while (++i <= 1)
+
+movzx ax, byte [bp - 3] ; ax = # alive neighbours
+
+leave