Negative XLEFT, almost saves a couple cycles

This commit is contained in:
blondie7575 2017-08-07 20:47:17 -07:00
parent 2ce5b45a91
commit ade60127d1
1 changed files with 34 additions and 27 deletions

View File

@ -52,7 +52,7 @@ renderClippedSpanChain:
; Prepare our state
; = 23 cycles per row + 80 cycles for actual pixels
lda #80 ; 2
lda #-80 ; 2
sta <XLEFT ; 3
lda #$1111 ; 2
sta <CURRMAPPIXELS ; 3
@ -75,8 +75,13 @@ renderClippedSpanChainLoop:
renderClippedSpanChainLoop2:
; Now render spans until left edge of screen
; = 28 cycles per span rendered
cmp <XLEFT ; 3
bcs renderClippedSpanChainLastSpan ; 2/3
;cmp <XLEFT ; 3
tax ; 2
clc ; 2
adc <XLEFT ; 3
bpl renderClippedSpanChainLastSpan ; 2/3
sta <XLEFT ; 3
txa ; 2 14
; Render this span
ldx spanColors,y ; 4
@ -86,28 +91,6 @@ renderClippedSpanChainLoop2:
tax ; 2
jmp (renderSpanJumpTable,x) ; 6 (jmp back = 6)
renderSpanComplete:
; This is modified to redirect return from the
; unrolled span rendering blocks
jmp renderClippedSpanChainRenderNext ; 3
renderClippedSpanChainRenderNext:
; Track remaining words until left edge
; = 26 cycles per span rendered
lsr ; 2
eor #$ffff ; 2
inc ; 2
clc ; 2
adc <XLEFT ; 3
sta <XLEFT ; 3
dey ; 2
dey ; 2
; For mid-stream spans, bypass the right-edge clipping code
lda spanChain,y ; 5
bra renderClippedSpanChainLoop2 ; 3
renderClippedSpanChainNextSpan:
; Track remaining distance from right edge and
; continue searching for visible right edge
@ -118,13 +101,37 @@ renderClippedSpanChainNextSpan:
dey ; 2
bra renderClippedSpanChainLoop ; 3
renderSpanComplete:
; This is modified to redirect return from the
; unrolled span rendering blocks
jmp renderClippedSpanChainRenderNext ; 3
renderClippedSpanChainRenderNext:
; Track remaining words until left edge
; = 26 cycles per span rendered
; lsr ; 2
; eor #$ffff ; 2
; inc ; 2
; clc ; 2
; adc <XLEFT ; 3
; sta <XLEFT ; 3
dey ; 2
dey ; 2
; For mid-stream spans, bypass the right-edge clipping code
lda spanChain,y ; 5
bra renderClippedSpanChainLoop2 ; 3
renderClippedSpanChainLastSpan:
; Render visible portion of last visible span
; = 26 cycles per row
ldx spanColors,y ; 4
stx <CURRMAPPIXELS ; 3
lda <XLEFT ; 3
brk
; lda <XLEFT ; 3
asl ; 2
tax ; 2