ds: credits cycle count good

This commit is contained in:
Vince Weaver 2019-11-02 22:30:51 -04:00
parent 81472025b4
commit db4c8a655a

View File

@ -142,9 +142,9 @@ credits_loop:
; -696 -- move+draw 4*(16+26+6+126) = 696
; -10 -- keypress
; -12 -- call/return of draw code
; -377 -- do_words
; -446 -- do_words
;=======
; 2873
; 2804
pad_time:
@ -155,7 +155,7 @@ pad_time:
; do words
;=========================
jsr draw_credits
jsr draw_credits ; 6+440
;=========================
; ERASE
@ -324,12 +324,12 @@ pad_time:
; WAIT for VBLANK to finish
;============================
; Try X=7 Y=70 cycles=2871 R2
; Try X=61 Y=9 cycles=2800 R4
nop
nop
ldy #70 ; 2
tloop1: ldx #7 ; 2
ldy #9 ; 2
tloop1: ldx #61 ; 2
tloop2: dex ; 2
bne tloop2 ; 2nt/3
dey ; 2
@ -416,84 +416,129 @@ yellow_x: .byte $20
green_x: .byte $30
blue_x: .byte $40
;=================================
; draw credits
;=================================
; credits pointer
;
; noframe: 13 = 13 (need 427) +12
; end: 13+12= 25 (need 415) +83
; newchar: 13+12+4+79 = 108 (need 333) +332
; putchar: 13+12+4+377+28+6 = 440
draw_credits:
inc FRAME ; 5
lda FRAME ; 3
and #$f ; 2
beq credits_handle_next ; 3
;====
; 13
credits_long_delay:
; -1
; 12+1 = 13 cycles
lda TEMP ; 3
lda TEMP ; 3
lda TEMP ; 3
nop ; 2
nop ; 2
credits_skip:
; 83 cycles
lda #56 ; 2
jsr delay_a ; delay 25+a (81)
credits_short_delay:
; 332 cycles-6 = 326
rts
; 83 cycles
lda #56 ; 2
jsr delay_a ; delay 25+a (81)
; 243 cycles
lda #216 ; 2
jsr delay_a ; delay 25+a (241)
rts ; 6
credits_handle_next:
ldy #0 ; 2
lda (CREDITS_POINTERL),Y ; 5+
lda (CREDITS_POINTERL),Y ; 5
cmp #$ff ; 2
beq credits_skip ; 3
;===
; 12
; -1
cmp #'@' ; 2
bcs credits_put_char ; bge ; 3
;====
; 4
credits_check_xy:
; -1
sta CREDITS_Y
iny
lda (CREDITS_POINTERL),Y
sta CREDITS_X
iny
lda (CREDITS_POINTERL),Y
sta colors_hi
iny
lda (CREDITS_POINTERL),Y
sta colors_hi+1
iny
lda (CREDITS_POINTERL),Y
sta colors_lo
iny
lda (CREDITS_POINTERL),Y
sta colors_lo+1
sta CREDITS_Y ; 3
iny ; 2
lda (CREDITS_POINTERL),Y ; 5
sta CREDITS_X ; 3
iny ; 2
;====
; 14
iny
clc
tya
adc CREDITS_POINTERL
sta CREDITS_POINTERL
lda #0
adc CREDITS_POINTERH
sta CREDITS_POINTERH
lda (CREDITS_POINTERL),Y ; 5
sta colors_hi ; 4
iny ; 2
lda (CREDITS_POINTERL),Y ; 5
sta colors_hi+1 ; 4
iny ; 2
lda (CREDITS_POINTERL),Y ; 5
sta colors_lo ; 4
iny ; 2
lda (CREDITS_POINTERL),Y ; 5
sta colors_lo+1 ; 4
iny ; 2
;===
; 44
jmp credits_short_delay
clc ; 2
tya ; 2
adc CREDITS_POINTERL ; 3
sta CREDITS_POINTERL ; 3
lda #0 ; 2
adc CREDITS_POINTERH ; 3
sta CREDITS_POINTERH ; 3
jmp credits_short_delay ; 3
;====
; 21
credits_put_char:
ldx CREDITS_X ; 2
ldx CREDITS_X ; 3
ldy CREDITS_Y ; 3
jsr put_char ; 6+365
;======
; 377
clc
lda CREDITS_X
adc #4
sta CREDITS_X
clc ; 2
lda CREDITS_X ; 3
adc #4 ; 2
sta CREDITS_X ; 3
clc
lda #1
adc CREDITS_POINTERL
sta CREDITS_POINTERL
lda #0
adc CREDITS_POINTERH
sta CREDITS_POINTERH
clc ; 2
lda #1 ; 2
adc CREDITS_POINTERL ; 3
sta CREDITS_POINTERL ; 3
lda #0 ; 2
adc CREDITS_POINTERH ; 3
sta CREDITS_POINTERH ; 3
;=====
; 28
draw_credits_end:
rts ; 6
.align $100
credits_text:
.byte 0,10, $C4,$CF,$FC,$4C, 'C','O','D','E','[' ; "CODE:"
.byte 4,8, $C4,$CF,$FC,$4C, 'D','E','A','T','E','R' ; "DEATER"
@ -507,5 +552,23 @@ credits_text:
.byte 0,8, $00,$00,$00,$00, 'M','U','S','I','C','[' ; "MUSIC:"
.byte 4,14, $00,$00,$00,$00, 'D','Y','A' ; "DYA"
.byte 0,8, $C4,$CF,$FC,$4C, 'M','A','G','I','C','[' ; "MAGIC:"
.byte 4,8, $C4,$CF,$FC,$4C, 'Q','K','U','M','B','A' ; "QKUMBA"
.byte '@','@' ; time pad
.byte 0,8, $00,$00,$00,$00, 'M','A','G','I','C','[' ; "MAGIC:"
.byte 4,8, $00,$00,$00,$00, 'Q','K','U','M','B','A' ; "QKUMBA"
.byte 0,8, $C4,$CF,$FC,$4C, 'T','H','A','N','K','S' ; "THANKS"
.byte 4,4, $C4,$CF,$FC,$4C, 'F','R','O','G','Y','S','U','E' ; "FROGYSUE"
.byte '@' ; time pad
.byte 0,8, $00,$00,$00,$00, 'T','H','A','N','K','S' ; "THANKS"
.byte 4,4, $00,$00,$00,$00, 'F','R','O','G','Y','S','U','E' ; "FROGYSUE"
.byte 0,10, $C4,$CF,$FC,$4C, 'A','@','V','M','W' ; "A VMW"
.byte 4,0, $C4,$CF,$FC,$4C, 'P','R','O','D','U','C','T','I','O','N'
; "PRODUCTION"
.byte 255 ; done
credits_text_end:
.assert >credits_text = >(credits_text_end-1), error, "credits_text crosses page"