Optimize neighbor count increment.

This commit is contained in:
Lee Fastenau 2017-05-05 09:41:29 -07:00
parent fa68f4a536
commit 3939a3e9e4

View File

@ -14,7 +14,7 @@
NOISY equ 1 ; 0 = Sound off, 1 = Sound on NOISY equ 1 ; 0 = Sound off, 1 = Sound on
CHARSET equ 4 ; 0 = Olde Skoole, 1 = Pixel, 2 = Inverse, 3 = Small O's, 4 = Enhanced CHARSET equ 4 ; 0 = Olde Skoole, 1 = Pixel, 2 = Inverse, 3 = Small O's, 4 = Enhanced
INIT_PATTERN equ 2 ; 0 = Glider gun, 1 = "Random", 2 = Edge test INIT_PATTERN equ 0 ; 0 = Glider gun, 1 = "Random", 2 = Edge test
TEST_PERF equ 0 ; 0 = Normal, 1 = Instrument for emulator cycle counting (forces Glider gun layout and sound off) TEST_PERF equ 0 ; 0 = Normal, 1 = Instrument for emulator cycle counting (forces Glider gun layout and sound off)
; ------------------------------------ ; ------------------------------------
@ -120,12 +120,24 @@ perfTest subroutine
echo "START TIMER BREAKPOINT:",.startTimer echo "START TIMER BREAKPOINT:",.startTimer
echo "END TIMER BREAKPOINT:",.endTimer echo "END TIMER BREAKPOINT:",.endTimer
mac TURN_ON mac INCREMENT_ADC
ldy #y_{1} ldy #y_{1} ; +2 2
clc lda (altData),y ; +5/6 8
lda (altData),y adc #1 ; +5 13 Relies on carry being clear
adc #1 sta (altData),y ; +6 19
sta (altData),y endm
mac INCREMENT_INX
ldy #y_{1} ; +2 2
lda (altData),y ; +5/6 8
tax ; +2 10
inx ; +2 12
txa ; +2 14
sta (altData),y ; +6 20
endm
mac INCREMENT
INCREMENT_ADC {1}
endm endm
iterate subroutine iterate subroutine
@ -163,13 +175,14 @@ iterate subroutine
if soundEnabled if soundEnabled
bit CLICK ; (Pretend I'm not here... I just click the speaker) bit CLICK ; (Pretend I'm not here... I just click the speaker)
endif endif
TURN_ON top clc
TURN_ON topright INCREMENT top
TURN_ON left INCREMENT topright
TURN_ON right INCREMENT left
TURN_ON bottomleft INCREMENT right
TURN_ON bottom INCREMENT bottomleft
TURN_ON bottomright INCREMENT bottom
INCREMENT bottomright
jmp .continue jmp .continue
.clearTopLeft ldy #y_topleft ; cell is off, so clear top left value to remove stale data .clearTopLeft ldy #y_topleft ; cell is off, so clear top left value to remove stale data
lda #0 lda #0
@ -226,13 +239,14 @@ updateData subroutine
ldy #y_topleft ; set top left value to one (previous value is stale) ldy #y_topleft ; set top left value to one (previous value is stale)
lda #1 lda #1
sta (altData),y sta (altData),y
TURN_ON top clc
TURN_ON topright INCREMENT top
TURN_ON left INCREMENT topright
TURN_ON right INCREMENT left
TURN_ON bottomleft INCREMENT right
TURN_ON bottom INCREMENT bottomleft
TURN_ON bottomright INCREMENT bottom
INCREMENT bottomright
jmp .nextColumn jmp .nextColumn
.clearTopLeft ldy #y_topleft .clearTopLeft ldy #y_topleft
lda #0 lda #0