mirror of
https://github.com/deater/dos33fsprogs.git
synced 2025-08-15 08:27:41 +00:00
pt3: mask/cache note_command bottom nibble
adds 8 cycles but removes a number of instructions
This commit is contained in:
@@ -15,6 +15,7 @@
|
|||||||
; + 3203 bytes -- combine common code in note decoder
|
; + 3203 bytes -- combine common code in note decoder
|
||||||
; + 2937 bytes -- qkumba first pass
|
; + 2937 bytes -- qkumba first pass
|
||||||
; + 2879 bytes -- qkumba second pass
|
; + 2879 bytes -- qkumba second pass
|
||||||
|
; + 2839 bytes -- mask note command in common code
|
||||||
|
|
||||||
; TODO
|
; TODO
|
||||||
; move some of these flags to be bits rather than bytes?
|
; move some of these flags to be bits rather than bytes?
|
||||||
@@ -220,6 +221,7 @@ temp_word_h: .byte $0
|
|||||||
|
|
||||||
note_command: ; shared space with sample_b0
|
note_command: ; shared space with sample_b0
|
||||||
sample_b0: .byte $0
|
sample_b0: .byte $0
|
||||||
|
note_command_bottom: ; shared space with sample_b1
|
||||||
sample_b1: .byte $0
|
sample_b1: .byte $0
|
||||||
|
|
||||||
; Header offsets
|
; Header offsets
|
||||||
@@ -1124,6 +1126,9 @@ note_decode_loop:
|
|||||||
; get next value
|
; get next value
|
||||||
lda (PATTERN_L),Y ; 5+
|
lda (PATTERN_L),Y ; 5+
|
||||||
sta note_command ; save termporarily ; 4
|
sta note_command ; save termporarily ; 4
|
||||||
|
and #$0f ; 2
|
||||||
|
sta note_command_bottom ; 4
|
||||||
|
lda note_command ; 4
|
||||||
|
|
||||||
; FIXME: use a jump table??
|
; FIXME: use a jump table??
|
||||||
; further reflection, that would require 32-bytes of addresses
|
; further reflection, that would require 32-bytes of addresses
|
||||||
@@ -1141,8 +1146,7 @@ decode_case_0X:
|
|||||||
; $0X set special effect
|
; $0X set special effect
|
||||||
;==============================
|
;==============================
|
||||||
; -1
|
; -1
|
||||||
lda note_command ; 4
|
lda note_command_bottom ; 4
|
||||||
and #$f ; 2
|
|
||||||
|
|
||||||
; we can always store spec as 0 means no spec
|
; we can always store spec as 0 means no spec
|
||||||
|
|
||||||
@@ -1180,8 +1184,7 @@ decode_case_1X:
|
|||||||
; 5
|
; 5
|
||||||
|
|
||||||
; -1
|
; -1
|
||||||
lda note_command ; 4
|
lda note_command_bottom ; 4
|
||||||
and #$0f
|
|
||||||
bne decode_case_not_10 ; 3
|
bne decode_case_not_10 ; 3
|
||||||
|
|
||||||
decode_case_10:
|
decode_case_10:
|
||||||
@@ -1215,7 +1218,7 @@ decode_case_3X:
|
|||||||
bcs decode_case_4X ; branch greater/equal ; 3
|
bcs decode_case_4X ; branch greater/equal ; 3
|
||||||
; -1
|
; -1
|
||||||
lda note_command ; 3
|
lda note_command ; 3
|
||||||
adc #$e0 ; 2
|
adc #$e0 ; same as subtract $20 ; 2
|
||||||
sta pt3_noise_period ; 3
|
sta pt3_noise_period ; 3
|
||||||
|
|
||||||
jmp done_decode ; 3
|
jmp done_decode ; 3
|
||||||
@@ -1229,8 +1232,7 @@ decode_case_4X:
|
|||||||
; cmp #$40 ; already set ;
|
; cmp #$40 ; already set ;
|
||||||
bne decode_case_5X ; 3
|
bne decode_case_5X ; 3
|
||||||
; -1
|
; -1
|
||||||
lda note_command ; 4
|
lda note_command_bottom ; set ornament to bottom nibble ; 4
|
||||||
and #$0f ; set ornament to bottom nibble ; 2
|
|
||||||
jsr load_ornament ; 6+93
|
jsr load_ornament ; 6+93
|
||||||
|
|
||||||
jmp done_decode ; 3
|
jmp done_decode ; 3
|
||||||
@@ -1262,49 +1264,48 @@ decode_case_bX:
|
|||||||
; $BX -- note length or envelope manipulation
|
; $BX -- note length or envelope manipulation
|
||||||
;============================================
|
;============================================
|
||||||
; cmp #$b0 ; already set from before
|
; cmp #$b0 ; already set from before
|
||||||
bne decode_case_cX
|
bne decode_case_cX ; 3
|
||||||
|
; -1
|
||||||
lda note_command
|
lda note_command_bottom ; 4
|
||||||
and #$f
|
beq decode_case_b0 ; 3
|
||||||
beq decode_case_b0
|
; -1
|
||||||
sbc #1 ; envelope_type=(current_val&0xf)-1;
|
sbc #1 ; envelope_type=(current_val&0xf)-1; ; 2
|
||||||
bne decode_case_bx_higher
|
bne decode_case_bx_higher ; 3
|
||||||
|
|
||||||
decode_case_b1:
|
decode_case_b1:
|
||||||
; Set Length
|
; Set Length
|
||||||
|
|
||||||
; get next byte
|
; get next byte
|
||||||
iny
|
iny ; 2
|
||||||
lda (PATTERN_L),Y
|
lda (PATTERN_L),Y ; 5
|
||||||
|
|
||||||
sta note_a+NOTE_LEN,X
|
sta note_a+NOTE_LEN,X ; 5
|
||||||
sta note_a+NOTE_LEN_COUNT,X
|
sta note_a+NOTE_LEN_COUNT,X ; 5
|
||||||
bcs done_decode ; branch always
|
bcs done_decode ; branch always ; 3
|
||||||
|
|
||||||
decode_case_b0:
|
decode_case_b0:
|
||||||
; Disable envelope
|
; Disable envelope
|
||||||
sta note_a+NOTE_ENVELOPE_ENABLED,X
|
sta note_a+NOTE_ENVELOPE_ENABLED,X ; 5
|
||||||
sta note_a+NOTE_ORNAMENT_POSITION,X
|
sta note_a+NOTE_ORNAMENT_POSITION,X ; 5
|
||||||
beq done_decode
|
beq done_decode ; 3
|
||||||
|
|
||||||
|
|
||||||
decode_case_bx_higher:
|
decode_case_bx_higher:
|
||||||
|
|
||||||
jsr set_envelope ; 6+64
|
jsr set_envelope ; 6+64
|
||||||
|
|
||||||
bcs done_decode ; branch always
|
bcs done_decode ; branch always ; 3
|
||||||
|
|
||||||
decode_case_cX:
|
decode_case_cX:
|
||||||
;==============================
|
;==============================
|
||||||
; $CX -- set volume
|
; $CX -- set volume
|
||||||
;==============================
|
;==============================
|
||||||
cmp #$c0
|
cmp #$c0 ; 2
|
||||||
bne decode_case_dX
|
bne decode_case_dX ; 3
|
||||||
|
; -1
|
||||||
lda note_command
|
lda note_command_bottom ; 4
|
||||||
and #$0f
|
bne decode_case_cx_not_c0 ; 3
|
||||||
bne decode_case_cx_not_c0
|
; -1
|
||||||
|
|
||||||
decode_case_c0:
|
decode_case_c0:
|
||||||
; special case $C0 means shut down the note
|
; special case $C0 means shut down the note
|
||||||
|
|
||||||
@@ -1327,8 +1328,7 @@ decode_case_dX:
|
|||||||
cmp #$d0
|
cmp #$d0
|
||||||
bne decode_case_eX
|
bne decode_case_eX
|
||||||
|
|
||||||
lda note_command
|
lda note_command_bottom
|
||||||
and #$0f
|
|
||||||
bne decode_case_dx_not_d0
|
bne decode_case_dx_not_d0
|
||||||
|
|
||||||
;========================
|
;========================
|
||||||
@@ -1364,8 +1364,7 @@ decode_case_fX:
|
|||||||
sta note_a+NOTE_ENVELOPE_ENABLED,X
|
sta note_a+NOTE_ENVELOPE_ENABLED,X
|
||||||
|
|
||||||
; Set ornament to low byte of command
|
; Set ornament to low byte of command
|
||||||
lda note_command
|
lda note_command_bottom
|
||||||
and #$f
|
|
||||||
jsr load_ornament ; ornament to load in A
|
jsr load_ornament ; ornament to load in A
|
||||||
|
|
||||||
; Get next byte
|
; Get next byte
|
||||||
|
Reference in New Issue
Block a user