it's not necessary to load mask into A, and can use direct value too! 11 => 10 VBLs

This commit is contained in:
2018-12-31 14:26:57 +01:00
parent 1c927caba1
commit 358f0912fc

View File

@@ -37,8 +37,7 @@ AddLiveNeighbors: MACRO
; load current 2x2 cell and mask out bits that are not neighbors ; load current 2x2 cell and mask out bits that are not neighbors
ld c, LOW(Cells + \1) ld c, LOW(Cells + \1)
ld a, [$FF00+c] ld a, [$FF00+c]
ld b, \2 and a, \2
and a, b
; count bits set ; count bits set
ld e, a ld e, a
@@ -71,14 +70,11 @@ Conway: MACRO
AddLiveNeighbors (1 + (\2 + 1) % 8), \4 AddLiveNeighbors (1 + (\2 + 1) % 8), \4
AddLiveNeighbors (1 + (\2 + 2) % 8), \5 AddLiveNeighbors (1 + (\2 + 2) % 8), \5
; load current group mask
ld b, (~\1) & $F
; load current cell group ; load current cell group
ldh a, [Cells] ldh a, [Cells]
; mask data ; mask data
and a, b and a, (~\1) & $F
; put alive neighbors in A ; put alive neighbors in A
ld a, h ld a, h
@@ -94,7 +90,7 @@ Conway: MACRO
.writealive\@ .writealive\@
; add mask to result ; add mask to result
ld a, l ld a, l
add a, b add a, (~\1) & $F
ld l, a ld l, a
jr .writedead\@ jr .writedead\@