interlace: add background

This commit is contained in:
Vince Weaver 2019-06-11 16:58:21 -04:00
parent 69123b527a
commit 4cb8895f1d
5 changed files with 1296 additions and 1203 deletions

View File

@ -33,7 +33,7 @@ RASTERBARS: rasterbars.o
ld65 -o RASTERBARS rasterbars.o -C ../linker_scripts/apple2_1000.inc
rasterbars.o: rasterbars.s gr_copy.s \
rasterbars_screen.s rasterbars_table.s movement_table.s k_40_48d.inc
rasterbars_screen.s rasterbars_table.s movement_table.s rb_bg.inc
ca65 -o rasterbars.o rasterbars.s -l rasterbars.lst
@ -42,6 +42,9 @@ rasterbars.o: rasterbars.s gr_copy.s \
k_40_48d.inc: k_40_48d.png
$(PNG_TO_40x48D) asm k_40_48d.png k > k_40_48d.inc
rb_bg.inc: rb_bg.png
$(PNG_TO_40x48D) asm rb_bg.png rb_bg > rb_bg.inc
###

View File

@ -11,31 +11,44 @@ static int gr_offsets[]={
int main(int argc, char **argv) {
int i,j;
int i,j,lookup,address;
for(i=0;i<96;i++) {
lookup=i/4;
printf("; %d\n",i*2);
printf("\tbit\tPAGE0\t; 4\n");
printf("smc%03d:\tlda\t#$00\t; 2\n",i*2);
for(j=0;j<14;j++) {
printf("\tsta\t$%3x\t; 4\n",
gr_offsets[i/4]+0x400+j+X_OFFSET);
address=gr_offsets[lookup]+0x400+j+X_OFFSET;
if (i<15) address=0xc00;
if (i>77) address=0xc00;
printf("\tsta\t$%3x\t; 4\n",address);
}
printf("\tlda\tTEMP\t; 3\n");
printf("\n");
lookup=i/4;
if (i%4==3) lookup=(i+4)/4;
if (i==95) lookup=0;
printf("; %d\n",(i*2)+1);
printf("\tbit\tPAGE1\t; 4\n");
printf("smc%03d:\tlda\t#$00\t; 2\n",(i*2)+1);
for(j=0;j<14;j++) {
printf("\tsta\t$%3x\t; 4\n",
gr_offsets[i/4]+j+X_OFFSET);
address=gr_offsets[lookup]+j+X_OFFSET;
if (i<15) address=0xc00;
if (i>77) address=0xc00;
printf("\tsta\t$%3x\t; 4\n",address);
}
printf("\tlda\tTEMP\t; 3\n");
printf("\n");
}
#if 0
printf("y_lookup_h:\n");
for(i=32;i<32+128;i++) {
if (i%8==0) printf(".byte\t");
@ -51,5 +64,6 @@ int main(int argc, char **argv) {
if (i%8!=7) printf(",");
else printf("\n");
}
#endif
return 0;
}

View File

@ -58,36 +58,37 @@ start_rasterbars:
lda #0
sta DRAW_PAGE
sta WHICH
;=============================
; Load graphic page0
; lda #$0c
; sta BASH
; lda #$00
; sta BASL ; load image to $c00
lda #$0c
sta BASH
lda #$00
sta BASL ; load image to $c00
; lda WHICH
; asl
; asl ; which*4
; tay
lda WHICH
asl
asl ; which*4
tay
; lda pictures,Y
; sta GBASL
; lda pictures+1,Y
; sta GBASH
; jsr load_rle_gr
lda pictures,Y
sta GBASL
lda pictures+1,Y
sta GBASH
jsr load_rle_gr
; lda #4
; sta DRAW_PAGE
lda #4
sta DRAW_PAGE
; jsr gr_copy_to_current ; copy to page1
jsr gr_copy_to_current ; copy to page1
; ; GR part
; bit PAGE1
; bit LORES ; 4
; bit SET_GR ; 4
; bit FULLGR ; 4
; GR part
bit PAGE1
bit LORES ; 4
bit SET_GR ; 4
bit FULLGR ; 4
; jsr wait_until_keypressed
@ -95,29 +96,29 @@ start_rasterbars:
;=============================
; Load graphic page1
; lda #$0c
; sta BASH
; lda #$00
; sta BASL ; load image to $c00
lda #$0c
sta BASH
lda #$00
sta BASL ; load image to $c00
; lda WHICH
; asl
; asl ; which*4
; tay
lda WHICH
asl
asl ; which*4
tay
; lda pictures+2,Y
; sta GBASL
; lda pictures+3,Y
; sta GBASH
; jsr load_rle_gr
lda pictures+2,Y
sta GBASL
lda pictures+3,Y
sta GBASH
jsr load_rle_gr
; lda #0
; sta DRAW_PAGE
lda #0
sta DRAW_PAGE
; jsr gr_copy_to_current
jsr gr_copy_to_current
; ; GR part
; bit PAGE0
bit PAGE0
; jsr wait_until_keypressed
@ -183,17 +184,33 @@ display_loop:
;======================================================
; 4550 -- VBLANK
; -162 -- erase 22+8+6+126 = 162
; -174 -- raster 16+26+6+126 = 174
; -10 -- keypress
;=======
; 4366
; 4204
pad_time:
; we erase, then draw
; doing a blanket erase of all 128 lines would cost 3459 cycles!
; erase red
lda #$00 ; 2
sta smc_raster_color1_1+1 ; 4
sta smc_raster_color1_2+1 ; 4
sta smc_raster_color2_1+1 ; 4
sta smc_raster_color2_2+1 ; 4
sta smc_raster_color3_1+1 ; 4
;=============
; 22
lda red_x ; 4
and #$7f ; 2
tax ; 2
jsr draw_rasterbar ; 6+126
; move red
@ -222,11 +239,13 @@ pad_time:
jsr draw_rasterbar ; 6+126
; Try X=43 Y=19 cycles=4200 R4
; Try X=57 Y=15 cycles=4366
nop
nop
ldy #15 ; 2
loop1: ldx #57 ; 2
ldy #19 ; 2
loop1: ldx #43 ; 2
loop2: dex ; 2
bne loop2 ; 2nt/3
dey ; 2
@ -251,7 +270,6 @@ no_keypress:
draw_rasterbar:
; clear all lines
ldy #0 ; 2
;====
@ -366,11 +384,8 @@ gr_offsets:
.include "delay_a.s"
pictures:
.word k_low,k_high
.word rb_bg_low,rb_bg_high
.include "k_40_48d.inc"
krg:
.byte $0
.include "rb_bg.inc"
red_x: .byte $10

File diff suppressed because it is too large Load Diff

60
interlace_demo/rb_bg.inc Normal file
View File

@ -0,0 +1,60 @@
rb_bg_low: .byte $28 ; ysize=48
.byte $FF, $0F, $F0, $00, $F0, $0F, $F0
.byte $00, $F0, $0F,$0F, $00, $0F, $FF, $0F
.byte $00, $FF, $0F,$0F, $00, $FF, $0F, $F0
.byte $00, $FF, $0F, $F0, $00, $F0, $0F
.byte $F0, $00, $FF, $0F, $F0, $00, $F0
.byte $0F,$0F, $00, $FF, $F0, $0F, $00, $FF
.byte $F0, $FF, $00, $0F, $F0,$F0, $00,$00, $FF
.byte $00,$00, $FF, $0F, $00,$00, $FF, $F0, $0F
.byte $00, $FF, $0F, $F0, $00, $FF, $F0
.byte $FF, $00, $FF, $F0, $0F, $00, $0F
.byte $F0,$F0, $00, $FF, $00, $FF, $00, $FF
.byte $00, $FF, $00, $F0,$F0, $0F, $00,$00, $FF
.byte $00,$00, $FF, $F0,$F0, $00, $FF, $00, $FF
.byte $00, $FF, $F0, $0F, $00, $FF, $00
.byte $FF, $00, $FF, $00, $FF, $00, $F0,$F0
.byte $0F, $A0,$9D,$00, $F0, $FF, $00,$00, $A3,$11, $44
.byte $A3,$22, $44, $A3,$22, $A0,$14,$00, $20,$20, $F0,$F0, $A3,$F7
.byte $60, $90, $01, $11, $41, $44, $42
.byte $22, $42, $44, $42, $22, $02, $A0,$12,$00
.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 $A1
rb_bg_high: .byte $28 ; ysize=48
.byte $FF, $5F, $F0, $00, $F0, $5F, $F0
.byte $00, $F0, $5F,$5F, $00, $5F, $FF, $5F
.byte $00, $FF, $5F,$5F, $00, $FF, $5F, $F0
.byte $00, $FF, $5F, $F0, $00, $F0, $5F
.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 $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 $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
.byte $05, $00,$00, $A3,$05, $00, $05, $00, $05
.byte $00, $05,$05, $00,$00, $05, $00, $05, $00
.byte $05, $00, $05, $00, $05,$05, $AF,$00, $AE,$66
.byte $A0,$1A,$00, $AE,$66, $A0,$1A,$00, $AE,$66, $A9,$00, $F0, $FF
.byte $00,$00, $A3,$11, $44, $A3,$22, $44, $A3,$22, $00,$00
.byte $AE,$66, $A4,$00, $20,$20, $F0,$F0, $A3,$F7, $60, $D0
.byte $01, $11, $41, $44, $42, $22, $42
.byte $44, $42, $22, $02, $00,$00, $AE,$66, $00,$00
.byte $20, $A3,$22, $FF, $F1, $F4, $F2, $FF
.byte $62, $19, $00, $11, $A3,$44, $22, $A3,$44
.byte $22, $A3,$00, $AE,$66, $00, $A5,$FF, $77, $A4,$F7
.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 $A1