mode7: rasterbars: optimize the row selection

This commit is contained in:
Vince Weaver 2018-01-31 01:06:23 -05:00
parent b4e9a5412f
commit d246bc82a1

View File

@ -158,60 +158,48 @@ set_row_color:
adc #18 ; add in 18 to center on screen adc #18 ; add in 18 to center on screen
sin_no_more: sin_no_more:
pha
lsr
tax
pla
pha
jsr put_color pha ; save row value
jsr put_color ; put color at row
pla ; restore row value
pla clc ; increment row value
tax adc #1
cpy 32 jsr put_color ; put color at row
beq no_inc
bmi yes_inc
dex
dex
yes_inc:
inx
no_inc:
txa ; horrific
pha
lsr
tax
pla
jsr put_color
iny ; increment for next time iny ; increment for next time
rts rts
;==================
; put_color
;==================
; A = row to set color of
; A trashed
put_color: put_color:
and #$1 ; see if even or odd clc
beq even_line ror ; row/2, with even/odd in carry
tax ; put row/2 in X
lda COLOR bcc even_line ; if even, skip to even
and #$f0 odd_line:
sta COLOR2 lda #$f0 ; load mask for odd
bcs finish_line
lda row_color,X
and #$0f
jmp done_line
even_line: even_line:
lda COLOR lda #$0f ; load mask for even
and #$0f finish_line:
sta COLOR2 sta MASK
lda row_color,X and COLOR ; mask off color
and #$f0 sta COLOR2 ; store for later
done_line: lda MASK
ora COLOR2 eor #$ff ; invert mask
sta row_color,X and row_color,X ; load existing color
ora COLOR2 ; combine
sta row_color,X ; store back
rts rts
@ -221,7 +209,6 @@ done_line:
.include "../asm_routines/pageflip.s" .include "../asm_routines/pageflip.s"
.include "../asm_routines/gr_setpage.s" .include "../asm_routines/gr_setpage.s"
;.include "../asm_routines/keypress.s"
.include "../asm_routines/gr_offsets.s" .include "../asm_routines/gr_offsets.s"
.include "../asm_routines/gr_fast_clear.s" .include "../asm_routines/gr_fast_clear.s"
.include "../asm_routines/gr_hlin.s" .include "../asm_routines/gr_hlin.s"