NSF Export doesn't get this instrument right

Please post about bugs here.
Forum rules
When making a bug report, please try to be as specific as possible. Include information on how to reproduce the bug and an example file if possible.
If the application crashed, please include the generated memory dump file as well.
User avatar
Posts: 320
Joined: Sat Apr 25, 2015 1:26 am
Location: :uoıʇɐɔoן

NSF Export doesn't get this instrument right

Postby TheMudkipMaster12 » Tue Jun 23, 2015 5:35 am

When I export this FTM to an NSF, it sounds different and I'm not sure what causes it.
How it's exported.nsf
Exported NSF
(5.91 KiB) Downloaded 77 times
How it should be.ftm
Original FTM
(1.01 KiB) Downloaded 78 times
"It's funny because cool, means cold." -Savestate, Feb. 17, 2016


User avatar
Posts: 475
Joined: Thu Apr 23, 2015 7:39 pm
Location: Hong Kong SAR

Re: NSF Export doesn't get this instrument right

Postby HertzDevil » Tue Jun 23, 2015 5:48 am

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
    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).
refactoring 0cc-famitracker

User avatar
Posts: 194
Joined: Tue Apr 21, 2015 12:05 am
Location: !wow

Re: NSF Export doesn't get this instrument right

Postby retrodpc » Thu Jun 28, 2018 4:13 am

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
Don't copypasta Quotes

my sondclop

Return to “Bug Reports”

Who is online

Users browsing this forum: No registered users and 1 guest