rbs: more cycle counting

This commit is contained in:
Vince Weaver 2019-06-19 12:34:37 -04:00
parent 52fbf2ca9e
commit c590879d08
3 changed files with 65 additions and 15 deletions

View File

@ -1783,9 +1783,11 @@ not_done:
; update pattern or line if necessary
; then calculate the values for the next frame
; 8+???
;==========================
; pattern done early!
.if 0
early_end:
inc current_pattern_smc+1 ; increment pattern ; 6
sta current_line_smc+1 ; 4
@ -1802,29 +1804,33 @@ check_subframe:
beq pattern_good ; 2/3
rts ; 6
.endif
pt3_make_frame:
; see if we need a new pattern
; we do if line==0 and subframe==0
; allow fallthrough where possible
current_line_smc:
lda #$d1 ; 2
.if 0
beq check_subframe ; 2/3
pattern_good:
; see if we need a new line
.endif
current_subframe_smc:
lda #$d1 ; 2
.if 0
bne line_good ; 2/3
; decode a new line
jsr pt3_decode_line ; 6+?
; check if pattern done early
.endif
pt3_pattern_done_smc:
lda #$d1 ; 2
.if 0
beq early_end ; 2/3
line_good:
@ -1833,10 +1839,11 @@ line_good:
inc current_subframe_smc+1 ; subframe++ ; 6
lda current_subframe_smc+1 ; 4
.endif
; if we hit pt3_speed, move to next
pt3_speed_smc:
eor #$d1 ; 2
.if 0
bne do_frame ; 2/3
next_line:
@ -1854,6 +1861,16 @@ next_pattern:
inc current_pattern_smc+1 ; increment pattern ; 6
.endif
;======================================
; do frame
;======================================
; ????? FIXME/calculate note
;
; 9+36+11+18+30+18+49 = 171
do_frame:
; AY-3-8910 register summary
;
@ -1870,14 +1887,18 @@ do_frame:
ldx #0 ; needed ; 2
stx PT3_MIXER_VAL ; 3
stx pt3_envelope_add_smc+1 ; 4
;===========
; 9
.if 0
;;ldx #(NOTE_STRUCT_SIZE*0) ; Note A ; 2
jsr calculate_note ; 6+?
ldx #(NOTE_STRUCT_SIZE*1) ; Note B ; 2
jsr calculate_note ; 6+?
ldx #(NOTE_STRUCT_SIZE*2) ; Note C ; 2
jsr calculate_note ; 6+?
;=============
; FIXME
.endif
; Note, we assume 1MHz timings, adjust pt3 as needed
; Load up the Frequency Registers
@ -1985,14 +2006,24 @@ envelope_diff:
; end-of-frame envelope update
;==============================
; if envelope delay 0, skip
; = 5+6 + [38] = 49
; else if envelope delay 1, skip
; = 5+8+6 + [30] = 49
; else
; = 5+8+30+6 = 49
pt3_envelope_delay_smc:
lda #$d1 ; 2
beq done_do_frame ; assume can't be negative? ; 3
; -1
beq done_do_frame_x ; assume can't be negative? ; 3
; do this if envelope_delay>0
; -1
dec pt3_envelope_delay_smc+1 ; 6
bne done_do_frame ; 2/3
bne done_do_frame_y ; 3
; only do if we hit 0
; -1
pt3_envelope_delay_orig_smc:
lda #$d1 ; reset envelope delay ; 2
sta pt3_envelope_delay_smc+1 ; 4
@ -2006,6 +2037,24 @@ pt3_envelope_slide_add_l_smc:
pt3_envelope_slide_add_h_smc:
adc #$d1 ; 2
sta pt3_envelope_slide_h_smc+1 ; 4
jmp done_do_frame ; 3
;===========
; 30
done_do_frame_x:
; waste 8
nop ; 2
nop ; 2
nop ; 2
nop ; 2
done_do_frame_y:
; waste 30
inc CYCLE_WASTE ; 5
inc CYCLE_WASTE ; 5
inc CYCLE_WASTE ; 5
inc CYCLE_WASTE ; 5
inc CYCLE_WASTE ; 5
inc CYCLE_WASTE ; 5
done_do_frame:

View File

@ -288,9 +288,10 @@ display_loop:
; -582 -- erase 22+4*(8+6+126) = 582
; -696 -- move+draw 4*(16+26+6+126) = 696
; -10 -- keypress
; -185 -- calc values
; -997 -- mockingboard out
;=======
; 2265
; 2080
pad_time:
@ -463,7 +464,7 @@ pad_time:
;============================
jsr pt3_make_frame
jsr pt3_make_frame ; 6+179
jsr mb_write_frame ; 6+921
@ -471,11 +472,10 @@ pad_time:
; WAIT for VBLANK to finish
;============================
; Try X=112 Y=4 cycles=2265
; Try X=45 Y=9 cycles=2080
ldy #4 ; 2
loop1: ldx #112 ; 2
ldy #9 ; 2
loop1: ldx #45 ; 2
loop2: dex ; 2
bne loop2 ; 2nt/3
dey ; 2

View File

@ -60,6 +60,7 @@ AY_REGISTERS = $50
ENVELOPE_FINE = $5B
ENVELOPE_COARSE = $5C
ENVELOPE_SHAPE = $5D
CYCLE_WASTE = $5E
PATTERN_L = $00
PATTERN_H = $01