Page 1 of 1

NSF Export doesn't get this instrument right

Posted: Tue Jun 23, 2015 5:35 am
by TheMudkipMaster12
When I export this FTM to an NSF, it sounds different and I'm not sure what causes it.

Re: NSF Export doesn't get this instrument right

Posted: Tue Jun 23, 2015 5:48 am
by HertzDevil
The channel note underflows, after which it is treated as a note higher than B-7. Such behaviour can be shown more simply by using a relative arpeggio sequence of {| -12} and no other sequences. One fix would be:

Code: Select all

@Relative:
    ; Relative
    clc
    lda var_ch_Note, x
    adc var_sequence_result
    bmi :+        ; add this line
    ; cmp #$01    ; these lines only work when the note value is 0x00 (C-0) since carry flag is cleared upon
    ; bcc :+      ; *unsigned* underflow and every unsigned 8-bit value other than 0x00 is larger than or equal to 0x01
    cmp #$5F
    bcc :++
    lda #$5F
    bne :++
:   lda #$01
:   sta var_ch_Note, x
    jmp @ArpDone

As relative arpeggio offsets are signed, the line ensures that all underflowed note values will be set to 0x01 (C#0) rather than 0x5F (B-7).

Re: NSF Export doesn't get this instrument right

Posted: Thu Jun 28, 2018 4:13 am
by retrodpc
If you do not wish to implement this fix yourself, you may also avoid this by not going too low and assuming that the note will floor at A-0