mode7: optimize rasterbars a bit

This commit is contained in:
Vince Weaver 2018-01-31 00:19:04 -05:00
parent 0118de5eee
commit 4f5f6d08d2

View File

@ -7,7 +7,7 @@
;=========== ;===========
ELEMENTS EQU 64 ELEMENTS EQU 64
NUM_ROWS EQU 20
;===================== ;=====================
; Rasterbars ; Rasterbars
@ -26,7 +26,7 @@ ELEMENTS EQU 64
;=============== ;===============
lda #0 ; 2 lda #0 ; 2
sta DRAW_PAGE ; 3 sta DRAW_PAGE ; 3
sta SCREEN_Y sta SCREEN_Y ; 3
;=========================== ;===========================
;=========================== ;===========================
@ -34,64 +34,51 @@ ELEMENTS EQU 64
;=========================== ;===========================
;=========================== ;===========================
raster_loop: raster_loop:
jsr clear_top ; clear screen
; clear rows ; clear rows
ldy #19 ; 2 ldy #(NUM_ROWS-1) ; 2
lda #0 lda #0 ; 2
init_rows:
sta row_color,Y
dey
bpl init_rows
jsr clear_top init_rows:
sta row_color,Y ; 5
dey ; 2
bpl init_rows ; 2nt/3
;================ ;================
; set colors ; set colors
lda #COLOR_BOTH_AQUA ; aqua lda #COLOR_BOTH_AQUA ; aqua
sta COLOR
ldy SCREEN_Y ldy SCREEN_Y
jsr set_row_color jsr set_row_color
lda #COLOR_BOTH_MEDIUMBLUE ; medium blue lda #COLOR_BOTH_MEDIUMBLUE ; medium blue
sta COLOR
iny
jsr set_row_color jsr set_row_color
lda #COLOR_BOTH_LIGHTGREEN ; light green lda #COLOR_BOTH_LIGHTGREEN ; light green
sta COLOR
iny
jsr set_row_color jsr set_row_color
lda #COLOR_BOTH_DARKGREEN ; green lda #COLOR_BOTH_DARKGREEN ; green
sta COLOR
iny
jsr set_row_color jsr set_row_color
lda #COLOR_BOTH_YELLOW ; yellow lda #COLOR_BOTH_YELLOW ; yellow
sta COLOR
iny
jsr set_row_color jsr set_row_color
lda #COLOR_BOTH_ORANGE ; orange lda #COLOR_BOTH_ORANGE ; orange
sta COLOR
iny
jsr set_row_color jsr set_row_color
lda #COLOR_BOTH_PINK ; pink lda #COLOR_BOTH_PINK ; pink
sta COLOR
iny
jsr set_row_color jsr set_row_color
lda #COLOR_BOTH_RED ; red lda #COLOR_BOTH_RED ; red
sta COLOR
iny
jsr set_row_color jsr set_row_color
;================= ;=================
; draw rows ; draw rows
ldy #19 ldy #(NUM_ROWS-1) ; 2
draw_rows_loop: draw_rows_loop:
lda row_color,Y lda row_color,Y
sta COLOR sta COLOR
@ -144,11 +131,13 @@ not_there:
;=================== ;===================
; set_row_color ; set_row_color
;=================== ;===================
; color in COLOR ; color in A
; Y=offset ; Y=offset
; Y preserved? ; Y preserved
set_row_color: ; A, X trashed
set_row_color:
sta COLOR
tya ; wrap y offset tya ; wrap y offset
and #(ELEMENTS-1) and #(ELEMENTS-1)
tax tax
@ -216,6 +205,8 @@ no_inc:
pla pla
jsr put_color jsr put_color
iny ; increment for next time
rts rts
put_color: put_color: