use B directly for result instead of L
This commit is contained in:
@@ -30,9 +30,12 @@ MemorySet:
|
|||||||
ret
|
ret
|
||||||
|
|
||||||
AddLiveNeighbors: MACRO
|
AddLiveNeighbors: MACRO
|
||||||
; H register will be incremented with number of alive neighbors
|
; \1 is offset in Cells table in HRAM
|
||||||
; destroys A, B, C, E, does not touch L nor D
|
; \2 is mask for 2x2 cell
|
||||||
; D must be high byte of a BitsSet table (for 0..15)
|
; D must be high byte of a BitsSet table (for 0..15)
|
||||||
|
; H register will be incremented with number of alive neighbors
|
||||||
|
; destroys A, C, E
|
||||||
|
; does not touch B, L
|
||||||
|
|
||||||
; 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)
|
||||||
@@ -55,7 +58,7 @@ Conway: MACRO
|
|||||||
; \4 = mask for second useful neighbor 2x2 cell
|
; \4 = mask for second useful neighbor 2x2 cell
|
||||||
; \5 = mask for third useful neighbor 2x2 cell
|
; \5 = mask for third useful neighbor 2x2 cell
|
||||||
;
|
;
|
||||||
; L will be updated with cell result
|
; B will be updated with cell result
|
||||||
; destroys all other registers
|
; destroys all other registers
|
||||||
|
|
||||||
; reset alive counter
|
; reset alive counter
|
||||||
@@ -89,9 +92,9 @@ Conway: MACRO
|
|||||||
|
|
||||||
.writealive\@
|
.writealive\@
|
||||||
; add mask to result
|
; add mask to result
|
||||||
ld a, l
|
ld a, b
|
||||||
add a, (~\1) & $F
|
add a, (~\1) & $F
|
||||||
ld l, a
|
ld b, a
|
||||||
jr .writedead\@
|
jr .writedead\@
|
||||||
|
|
||||||
.dead\@
|
.dead\@
|
||||||
@@ -150,7 +153,7 @@ ConwayGroup: MACRO
|
|||||||
|
|
||||||
; reset result
|
; reset result
|
||||||
xor a
|
xor a
|
||||||
ld l, a
|
ld b, a
|
||||||
|
|
||||||
; compute all 4 cells in current 2x2 cell
|
; compute all 4 cells in current 2x2 cell
|
||||||
Conway 14, 4, 10, 8, 12
|
Conway 14, 4, 10, 8, 12
|
||||||
@@ -158,9 +161,6 @@ ConwayGroup: MACRO
|
|||||||
Conway 11, 2, 3, 2, 10
|
Conway 11, 2, 3, 2, 10
|
||||||
Conway 7, 0, 5, 1, 3
|
Conway 7, 0, 5, 1, 3
|
||||||
|
|
||||||
; move result to B
|
|
||||||
ld b, l
|
|
||||||
|
|
||||||
; load new pointer
|
; load new pointer
|
||||||
ld hl, New
|
ld hl, New
|
||||||
ld a, [hl+]
|
ld a, [hl+]
|
||||||
|
|||||||
Reference in New Issue
Block a user