automata bugfixes
This commit is contained in:
@@ -481,17 +481,13 @@ Conway:
|
|||||||
xor a
|
xor a
|
||||||
ldh [Alive], a
|
ldh [Alive], a
|
||||||
|
|
||||||
; load cells pointer to first neighbor
|
; load cells pointer
|
||||||
ld c, LOW(Cells + 1)
|
ld c, LOW(Cells)
|
||||||
|
|
||||||
.loop
|
.loop
|
||||||
; load next mask
|
; load next mask
|
||||||
ld a, [hl+]
|
ld a, [hl+]
|
||||||
|
|
||||||
; check end of table
|
|
||||||
cp a, $FF
|
|
||||||
jr z, .decide
|
|
||||||
|
|
||||||
; move mask to d
|
; move mask to d
|
||||||
ld d, a
|
ld d, a
|
||||||
|
|
||||||
@@ -517,10 +513,12 @@ Conway:
|
|||||||
inc c
|
inc c
|
||||||
|
|
||||||
; loop over all neighbors
|
; loop over all neighbors
|
||||||
jr .loop
|
ld a, c
|
||||||
|
cp a, LOW(Cells + 9)
|
||||||
|
jr nz, .loop
|
||||||
|
|
||||||
; load current group mask
|
|
||||||
.decide
|
.decide
|
||||||
|
; load current group mask
|
||||||
ld b, [hl]
|
ld b, [hl]
|
||||||
|
|
||||||
; load current cell group
|
; load current cell group
|
||||||
@@ -546,8 +544,8 @@ Conway:
|
|||||||
ret
|
ret
|
||||||
|
|
||||||
.dead
|
.dead
|
||||||
; check if there is two neighbors
|
; check if there is three neighbors
|
||||||
cp a, 2
|
cp a, 3
|
||||||
jr z, .writealive
|
jr z, .writealive
|
||||||
|
|
||||||
.writedead
|
.writedead
|
||||||
@@ -726,11 +724,11 @@ RightColumn: dw -19, 1, 20, 19, -1, -21, -20, -39
|
|||||||
Inner: dw 1, 21, 20, 19, -1, -21, -20, -19
|
Inner: dw 1, 21, 20, 19, -1, -21, -20, -19
|
||||||
|
|
||||||
SECTION "Game of Life neighboring masks", ROM0
|
SECTION "Game of Life neighboring masks", ROM0
|
||||||
; order matters I, R, BR, B, BL, L, TL, T, TR, SELF, END
|
; order matters I, R, BR, B, BL, L, TL, T, TR, SELF
|
||||||
TopLeftMask: db 14, 0, 0, 0, 0, 10, 8, 12, 0, 1, $FF
|
TopLeftMask: db 14, 0, 0, 0, 0, 10, 8, 12, 0, 1
|
||||||
TopRightMask: db 13, 5, 0, 0, 0, 0, 0, 12, 4, 2, $FF
|
TopRightMask: db 13, 5, 0, 0, 0, 0, 0, 12, 4, 2
|
||||||
BottomLeftMask: db 11, 0, 0, 3, 2, 10, 0, 0, 0, 4, $FF
|
BottomLeftMask: db 11, 0, 0, 3, 2, 10, 0, 0, 0, 4
|
||||||
BottomRightMask: db 7, 5, 1, 3, 0, 0, 0, 0, 0, 8, $FF
|
BottomRightMask: db 7, 5, 1, 3, 0, 0, 0, 0, 0, 8
|
||||||
|
|
||||||
SECTION "Bits Set", ROM0, ALIGN[4]
|
SECTION "Bits Set", ROM0, ALIGN[4]
|
||||||
BitsSet:
|
BitsSet:
|
||||||
|
|||||||
Reference in New Issue
Block a user