avoid resetting D to HIGH(BitsSet) unnecessarily
This commit is contained in:
@@ -31,7 +31,8 @@ MemorySet:
|
|||||||
|
|
||||||
AddLiveNeighbors: MACRO
|
AddLiveNeighbors: MACRO
|
||||||
; H register will be incremented with number of alive neighbors
|
; H register will be incremented with number of alive neighbors
|
||||||
; destroys A, B, C, D, E, does not touch L
|
; destroys A, B, C, E, does not touch L nor D
|
||||||
|
; D must be high byte of a BitsSet table (for 0..15)
|
||||||
|
|
||||||
; 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)
|
||||||
@@ -40,7 +41,6 @@ AddLiveNeighbors: MACRO
|
|||||||
and a, b
|
and a, b
|
||||||
|
|
||||||
; count bits set
|
; count bits set
|
||||||
ld d, HIGH(BitsSet)
|
|
||||||
ld e, a
|
ld e, a
|
||||||
ld a, [de]
|
ld a, [de]
|
||||||
|
|
||||||
@@ -62,6 +62,9 @@ Conway: MACRO
|
|||||||
; reset alive counter
|
; reset alive counter
|
||||||
ld h, 0
|
ld h, 0
|
||||||
|
|
||||||
|
; set high byte of DE to BitsSet high address
|
||||||
|
ld d, HIGH(BitsSet)
|
||||||
|
|
||||||
; Check all neighbors
|
; Check all neighbors
|
||||||
AddLiveNeighbors 0, \1
|
AddLiveNeighbors 0, \1
|
||||||
AddLiveNeighbors (1 + (\2 + 0) % 8), \3
|
AddLiveNeighbors (1 + (\2 + 0) % 8), \3
|
||||||
|
|||||||
Reference in New Issue
Block a user