ds: autogen graphcis code

This commit is contained in:
Vince Weaver 2019-11-02 00:01:15 -04:00
parent 4b59ef7ae7
commit 65e0d56062
5 changed files with 93 additions and 22 deletions

View File

@ -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

View File

@ -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

View File

@ -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 OUTL
lda #>UPDATE_START
sta OUTH
lda #<one_scanline
sta INL
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

View File

@ -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

View File

@ -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