interlace: re-cycle count sample/ornament load

This commit is contained in:
Vince Weaver 2019-09-14 23:22:05 -04:00
parent 101e7b279f
commit eab946a051
2 changed files with 29 additions and 22 deletions

View File

@ -6,15 +6,23 @@
;===========================
; Load Ornament 0/Sample 1
;===========================
; these only called by init so in theory are not cycle critical
load_ornament0_sample1:
lda #0 ; 2
jsr load_ornament ; 6
load_sample1:
lda #1 ; 2
; fall through
;===========================
;===========================
; Load Sample
;===========================
;===========================
; cycles: 72 (NOTE SAMPLES MUST NOT CROSS PAGE BOUNDARY)
;===========================
;===========================
; sample in A
; which note offset in X
@ -26,11 +34,6 @@ load_ornament0_sample1:
; and then leave SAMPLE_H:SAMPLE_L pointing to begnning of
; the sample data
; Optimization:
; see comments on ornament setting
load_sample1:
lda #1 ; 2
load_sample:
@ -59,34 +62,38 @@ load_sample:
ldy #0 ; 2
lda (SAMPLE_L),Y ; 5+
sta note_a+NOTE_SAMPLE_LOOP,X ; 5
sta note_a+NOTE_SAMPLE_LOOP,X ; 4
; Set the length value
; a->sample_length=pt3->data[a->sample_pointer];
iny ; 2
lda (SAMPLE_L),Y ; 5+
sta note_a+NOTE_SAMPLE_LENGTH,X ; 5
sta note_a+NOTE_SAMPLE_LENGTH,X ; 4
; Set pointer to beginning of samples
lda SAMPLE_L ; 3
adc #$2 ; 2
sta note_a+NOTE_SAMPLE_POINTER_L,X ; 5
sta note_a+NOTE_SAMPLE_POINTER_L,X ; 4
lda SAMPLE_H ; 3
adc #$0 ; 2
sta note_a+NOTE_SAMPLE_POINTER_H,X ; 5
sta note_a+NOTE_SAMPLE_POINTER_H,X ; 4
ldy PT3_TEMP ; 3
rts ; 6
;============
; 76
; 72
;===========================
; Load Ornament
;===========================
;===========================
; cycles: 78 (NOTE SAMPLES MUST NOT CROSS PAGE BOUNDARY)
;===========================
;===========================
; ornament value in A
; note offset in X
@ -127,38 +134,34 @@ load_ornament:
sta ORNAMENT_H ; 3
lda #0 ; 2
sta note_a+NOTE_ORNAMENT_POSITION,X ; 5
sta note_a+NOTE_ORNAMENT_POSITION,X ; 4
tay ; 2
; Set the loop value
; a->ornament_loop=pt3->data[a->ornament_pointer];
lda (ORNAMENT_L),Y ; 5+
sta note_a+NOTE_ORNAMENT_LOOP,X ; 5
sta note_a+NOTE_ORNAMENT_LOOP,X ; 4
; Set the length value
; a->ornament_length=pt3->data[a->ornament_pointer];
iny ; 2
lda (ORNAMENT_L),Y ; 5+
sta note_a+NOTE_ORNAMENT_LENGTH,X ; 5
sta note_a+NOTE_ORNAMENT_LENGTH,X ; 4
; Set the pointer to the value past the length
lda ORNAMENT_L ; 3
adc #$2 ; 2
sta note_a+NOTE_ORNAMENT_POINTER_L,X ; 5
sta note_a+NOTE_ORNAMENT_POINTER_L,X ; 4
lda ORNAMENT_H ; 3
adc #$0 ; 2
sta note_a+NOTE_ORNAMENT_POINTER_H,X ; 5
sta note_a+NOTE_ORNAMENT_POINTER_H,X ; 4
ldy PT3_TEMP ; restore Y value ; 3
rts ; 6
;============
; 83
; 78

View File

@ -232,14 +232,20 @@ note_c:
end_vars:
.endif
; this is only called by lib_init
load_ornament0_sample1:
lda #0 ; 2
jsr load_ornament ; 6
; fall through
load_sample1:
lda #1 ; 2
;===========================
;===========================
; Load Sample
;===========================
;===========================
; sample in A
; which note offset in X
@ -254,8 +260,6 @@ load_ornament0_sample1:
; Optimization:
; see comments on ornament setting
load_sample1:
lda #1 ; 2
load_sample: