diff --git a/demosplash/Makefile b/demosplash/Makefile index 78d49e44..9cad1ef5 100644 --- a/demosplash/Makefile +++ b/demosplash/Makefile @@ -54,6 +54,7 @@ musictest.o: musictest.s \ pt3_lib_play_frame.s pt3_lib_write_frame.s \ interrupt_handler.s \ missing.s k_40_48d.inc missing_screen_update.s \ + create_update_type1.s \ dya_space_demo2.pt3 ca65 -o musictest.o musictest.s -l musictest.lst diff --git a/demosplash/NOTES b/demosplash/NOTES index 5ec6f7d7..679d7103 100644 --- a/demosplash/NOTES +++ b/demosplash/NOTES @@ -67,7 +67,8 @@ Memory Map ~~~~~~~~~~ 0000-00ff zero page 0100-01ff stack -0200-02ff ????? +0200 fake store for graphics update +0201-02ff ????? 0300-03ff nibble table, irq vectors 0400-07FF lores page1 0800-0bff lores page2 diff --git a/demosplash/create_update_type1.s b/demosplash/create_update_type1.s new file mode 100644 index 00000000..6841c9b6 --- /dev/null +++ b/demosplash/create_update_type1.s @@ -0,0 +1,69 @@ + + ; Autogenerates code that does interleaved Page0/Page1 lores mode + ; but leaving room for 14 pixels/line of per-scanline color + +UPDATE_START = $9000 + +create_update_type1: + ldx #192 + lda #UPDATE_START + sta OUTH + lda #one_scanline + sta INH +create_update_outer_loop: + ldy #0 +create_update_inner_loop: + lda (INL),Y + sta (OUTL),Y + iny + cpy #49 + bne create_update_inner_loop + + ; toggl PAGE0/PAGE1 + txa + and #$1 ; ror? + clc + adc #$54 + ldy #1 + sta (OUTL),Y + + clc + lda #49 + adc OUTL + sta OUTL + lda OUTH + adc #0 + sta OUTH + + dex + bne create_update_outer_loop + + ldy #0 + lda #$60 + sta (OUTL),Y + + rts + +one_scanline: +.byte $2C,$54,$C0 ; bit PAGE0 ; 4 +.byte $A9,$0B ; lda #$0b ; 2 +.byte $8D,$00,$02 ; sta $200 ; 4 +.byte $8D,$00,$02 ; sta $200 ; 4 +.byte $8D,$00,$02 ; sta $200 ; 4 +.byte $8D,$00,$02 ; sta $200 ; 4 +.byte $8D,$00,$02 ; sta $200 ; 4 +.byte $8D,$00,$02 ; sta $200 ; 4 +.byte $8D,$00,$02 ; sta $200 ; 4 +.byte $8D,$00,$02 ; sta $200 ; 4 +.byte $8D,$00,$02 ; sta $200 ; 4 +.byte $8D,$00,$02 ; sta $200 ; 4 +.byte $8D,$00,$02 ; sta $200 ; 4 +.byte $8D,$00,$02 ; sta $200 ; 4 +.byte $8D,$00,$02 ; sta $200 ; 4 +.byte $8D,$00,$02 ; sta $200 ; 4 +.byte $A5,$FA ; lda TEMP ; 3 + diff --git a/demosplash/missing.s b/demosplash/missing.s index 937d52da..290c8373 100644 --- a/demosplash/missing.s +++ b/demosplash/missing.s @@ -18,6 +18,11 @@ missing_intro: lda #0 sta DRAW_PAGE + ;============================= + ; setup graphics code + + jsr create_update_type1 + ;============================= ; Load graphic page0 @@ -130,17 +135,20 @@ mloopB: dex ; 2 missing_display_loop: -.include "missing_screen_update.s" + jsr $9000 ; update_type1 +;.include "missing_screen_update.s" ;====================================================== ; We have 4550 cycles in the vblank, use them wisely ;====================================================== ; do_nothing should be ; 4550 - ; -6 - ; -10 + ; -12 jsr/ret to update_type1 + ; -6 jsr do_nothing_missing + ; - 7 check keypress + ; - 3 jmp loop ;============= - ; 4534 + ; 4522 jsr do_nothing_missing ; 6 @@ -158,32 +166,23 @@ missing_no_keypress: ;================================= ; do nothing ;================================= - ; and take 4534-6 = 4528 cycles to do it + ; and take 4522 cycles to do it ; blah, current code the tight loops are right at a page boundary do_nothing_missing: - ; want 4528-12=4516 + ; want 4522-6 (return)=4516 - ; Try X=4 Y=174 cycles=4525 R3 -3 X loops + ;Try X=99 Y=9 cycles=4510 R6 - ; Try X=3 Y=215 cycles=4516 + nop + nop + nop - nop ; 2 - nop ; 2 - - nop ; 2 - nop ; 2 - - nop ; 2 - nop ; 2 - - - - ldy #215 ; 2 -gloop1: ldx #3 ; 2 + ldy #9 ; 2 +gloop1: ldx #99 ; 2 gloop2: dex ; 2 bne gloop2 ; 2nt/3 dey ; 2 diff --git a/demosplash/musictest.s b/demosplash/musictest.s index 8e29f0f0..a3345422 100644 --- a/demosplash/musictest.s +++ b/demosplash/musictest.s @@ -199,6 +199,7 @@ wait_until_keypressed: .include "interrupt_handler.s" .include "pt3_lib_play_frame.s" .include "pt3_lib_write_frame.s" +.include "create_update_type1.s" PT3_LOC = song