From e1c2c2356b8429eb4d83cab93d98f36fa616d594 Mon Sep 17 00:00:00 2001 From: Vince Weaver Date: Tue, 11 Jun 2019 17:07:50 -0400 Subject: [PATCH] interlace: 4 bars --- interlace_demo/rasterbars.s | 142 ++++++++++++++++++++++++++++++++++-- interlace_demo/rb_bg.inc | 13 ++-- interlace_demo/rb_bg.png | Bin 1076 -> 1073 bytes 3 files changed, 141 insertions(+), 14 deletions(-) diff --git a/interlace_demo/rasterbars.s b/interlace_demo/rasterbars.s index dca77297..27ccedce 100644 --- a/interlace_demo/rasterbars.s +++ b/interlace_demo/rasterbars.s @@ -184,18 +184,20 @@ display_loop: ;====================================================== ; 4550 -- VBLANK - ; -162 -- erase 22+8+6+126 = 162 - ; -174 -- raster 16+26+6+126 = 174 + ; -582 -- erase 22+4*(8+6+126) = 582 + ; -696 -- move+draw 4*(16+26+6+126) = 696 ; -10 -- keypress ;======= - ; 4204 + ; 3262 pad_time: ; we erase, then draw ; doing a blanket erase of all 128 lines would cost 3459 cycles! - ; erase red + ;========================= + ; ERASE + ;========================= lda #$00 ; 2 sta smc_raster_color1_1+1 ; 4 @@ -206,13 +208,45 @@ pad_time: ;============= ; 22 + ; erase red + lda red_x ; 4 and #$7f ; 2 tax ; 2 jsr draw_rasterbar ; 6+126 + ; erase yellow + lda yellow_x ; 4 + and #$7f ; 2 + tax ; 2 + + jsr draw_rasterbar ; 6+126 + + ; erase green + + lda green_x ; 4 + and #$7f ; 2 + tax ; 2 + + jsr draw_rasterbar ; 6+126 + + ; erase red + + lda blue_x ; 4 + and #$7f ; 2 + tax ; 2 + + jsr draw_rasterbar ; 6+126 + + + ;========================= + ; MOVE and DRAW + ;========================= + + + ;============ ; move red ldy red_x ; 4 @@ -239,13 +273,102 @@ pad_time: jsr draw_rasterbar ; 6+126 - ; Try X=43 Y=19 cycles=4200 R4 + + ;============ + ; move yellow + + ldy yellow_x ; 4 + lda movement_table,Y ; 4 + sta yellow_x ; 4 + and #$7f ; 2 + tax ; 2 + ;========== + ; 16 + + ; draw yellow + + lda #$33 ; 2 + sta smc_raster_color1_1+1 ; 4 + sta smc_raster_color1_2+1 ; 4 + lda #$bb ; 2 + sta smc_raster_color2_1+1 ; 4 + sta smc_raster_color2_2+1 ; 4 + lda #$ff ; 2 + sta smc_raster_color3_1+1 ; 4 + ;============= + ; 26 + + + jsr draw_rasterbar ; 6+126 + + ;============ + ; move green + + ldy green_x ; 4 + lda movement_table,Y ; 4 + sta green_x ; 4 + and #$7f ; 2 + tax ; 2 + ;========== + ; 16 + + ; draw green + + lda #$33 ; 2 + sta smc_raster_color1_1+1 ; 4 + sta smc_raster_color1_2+1 ; 4 + lda #$bb ; 2 + sta smc_raster_color2_1+1 ; 4 + sta smc_raster_color2_2+1 ; 4 + lda #$ff ; 2 + sta smc_raster_color3_1+1 ; 4 + ;============= + ; 26 + + + jsr draw_rasterbar ; 6+126 + + ;============ + ; move blue + + ldy blue_x ; 4 + lda movement_table,Y ; 4 + sta blue_x ; 4 + and #$7f ; 2 + tax ; 2 + ;========== + ; 16 + + ; draw blue + + lda #$33 ; 2 + sta smc_raster_color1_1+1 ; 4 + sta smc_raster_color1_2+1 ; 4 + lda #$bb ; 2 + sta smc_raster_color2_1+1 ; 4 + sta smc_raster_color2_2+1 ; 4 + lda #$ff ; 2 + sta smc_raster_color3_1+1 ; 4 + ;============= + ; 26 + + + jsr draw_rasterbar ; 6+126 + + + + + ;============================ + ; WAIT for VBLANK to finish + ;============================ + ; Try X=5 Y=105 cycles=3256 R6 + nop nop nop - ldy #19 ; 2 -loop1: ldx #43 ; 2 + ldy #105 ; 2 +loop1: ldx #5 ; 2 loop2: dex ; 2 bne loop2 ; 2nt/3 dey ; 2 @@ -388,4 +511,7 @@ pictures: .include "rb_bg.inc" -red_x: .byte $10 +red_x: .byte $10 +yellow_x: .byte $20 +green_x: .byte $30 +blue_x: .byte $40 diff --git a/interlace_demo/rb_bg.inc b/interlace_demo/rb_bg.inc index bb5ddefd..645137fc 100644 --- a/interlace_demo/rb_bg.inc +++ b/interlace_demo/rb_bg.inc @@ -21,7 +21,8 @@ rb_bg_low: .byte $28 ; ysize=48 .byte $20, $A3,$22, $FF, $F1, $F4, $F2, $FF .byte $62, $00,$00, $01, $A3,$04, $02, $A3,$04, $02 .byte $A0,$12,$00, $A5,$FF, $77, $A4,$F7, $02, $09, $A0,$FF,$00 - .byte $A0,$C3,$00, $A0,$14,$80, $A0,$12,$00, $A0,$18,$80, $AE,$00, $A0,$1C,$80, $A6,$00 + .byte $A0,$C3,$00, $A0,$14,$08, $A0,$12,$00, $A0,$18,$08, $AD,$00, $80, $A0,$1C,$88 + .byte $80, $A5,$00 .byte $A1 rb_bg_high: .byte $28 ; ysize=48 .byte $FF, $5F, $F0, $00, $F0, $5F, $F0 @@ -31,13 +32,13 @@ rb_bg_high: .byte $28 ; ysize=48 .byte $F0, $00, $FF, $5F, $F0, $00, $F0 .byte $5F,$5F, $00, $FF, $F0, $0F, $00, $FF .byte $F0, $FF, $00, $5F, $F0,$F0, $00,$00, $FF - .byte $00,$00, $FF, $5F, $00,$00, $FF, $F0, $5F - .byte $00, $FF, $5F, $F5, $00, $FF, $F0 + .byte $00,$00, $FF, $5F, $00,$00, $FF, $F0, $0F + .byte $00, $FF, $5F, $F0, $00, $FF, $F0 .byte $FF, $00, $FF, $F0, $0F, $00, $5F .byte $F0,$F0, $00, $FF, $05, $FF, $00, $FF .byte $05, $FF, $00, $F0, $F5, $5F, $00,$00 .byte $FF, $00,$00, $FF, $F0,$F0, $00, $FF, $05 - .byte $FF, $00, $FF, $F0, $0F, $00, $FF + .byte $FF, $00, $FF, $F0, $5F, $00, $FF .byte $05, $FF, $00, $FF, $05, $FF, $00 .byte $F0, $F5, $5F, $00, $05, $00, $05 .byte $00, $05, $00, $05, $00, $05,$05, $A3,$00 @@ -55,6 +56,6 @@ rb_bg_high: .byte $28 ; ysize=48 .byte $02, $0D, $AD,$00, $AE,$66, $A0,$1A,$00, $AE,$66, $A0,$1A,$00 .byte $AE,$66, $A0,$1A,$00, $AE,$66, $A0,$1A,$00, $AE,$66, $A0,$1A,$00, $AE,$66 .byte $A0,$1A,$00, $AE,$66, $A0,$1A,$00, $AE,$66, $A0,$1A,$00, $AE,$66, $A0,$1A,$00 - .byte $AE,$66, $A0,$19,$00, $A0,$10,$80, $A0,$16,$00, $80, $A0,$12,$88, $80 - .byte $A0,$12,$00, $A0,$18,$80, $AE,$00, $A0,$1C,$80, $A6,$00 + .byte $AE,$66, $A0,$18,$00, $80, $A0,$10,$88, $80, $A0,$15,$00, $A0,$14,$08 + .byte $A0,$12,$00, $A0,$18,$08, $AD,$00, $80, $A0,$1C,$88, $80, $A5,$00 .byte $A1 diff --git a/interlace_demo/rb_bg.png b/interlace_demo/rb_bg.png index e68a5f965c4f3756eb56a4585867931f91ee4ad8..3a5f7869869088eb7cc74ca565055dcf3c95852f 100644 GIT binary patch delta 235 zcmVYKQYov2dVy(QRNKWitg2wnL8Hu{S?=P`hU_AZPw?4rW`~rBZw3lm< lVMX+YLPMXjVG*002ovPDHLkV1nUsYA^r* delta 238 zcmVWPXm8BFgG^`mjD0&$4Nv%R5;7+l3@;lFbsu@p+AUIlmzQ_(abXw zF%1)_i;+^(G5C3F;sjEfBh(%qTTx1%`pV-x;yY>2rJs5Gbe?AEw?J$J?Z+5~!HI}g z3-sQvgCbDf#uYHmBKnYPjC9V4*1{P@a$@%qG{&oBB