From 358f0912fcaf20049978a2f142d20439cc9b8e5a Mon Sep 17 00:00:00 2001 From: Daniel Borges Date: Mon, 31 Dec 2018 14:26:57 +0100 Subject: [PATCH] it's not necessary to load mask into A, and can use direct value too! 11 => 10 VBLs --- Code/main.asm | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/Code/main.asm b/Code/main.asm index a0f0820..a4be0d9 100644 --- a/Code/main.asm +++ b/Code/main.asm @@ -37,8 +37,7 @@ AddLiveNeighbors: MACRO ; load current 2x2 cell and mask out bits that are not neighbors ld c, LOW(Cells + \1) ld a, [$FF00+c] - ld b, \2 - and a, b + and a, \2 ; count bits set ld e, a @@ -71,14 +70,11 @@ Conway: MACRO AddLiveNeighbors (1 + (\2 + 1) % 8), \4 AddLiveNeighbors (1 + (\2 + 2) % 8), \5 - ; load current group mask - ld b, (~\1) & $F - ; load current cell group ldh a, [Cells] ; mask data - and a, b + and a, (~\1) & $F ; put alive neighbors in A ld a, h @@ -94,7 +90,7 @@ Conway: MACRO .writealive\@ ; add mask to result ld a, l - add a, b + add a, (~\1) & $F ld l, a jr .writedead\@