diff --git a/.gitignore b/.gitignore index 7d1b2c4b..ad735c2d 100644 --- a/.gitignore +++ b/.gitignore @@ -43,6 +43,10 @@ Dn-help/* # this should be automatically generated at build hlp/HTMLDefines.h +# generated headers +/Source/drivers/*.h +/Source/drivers/asm/build/* + ## Ignore Visual Studio temporary files, build results, and ## files generated by popular Visual Studio add-ons. ## @@ -441,6 +445,3 @@ FodyWeavers.xsd # JetBrains Rider *.sln.iml - -# generated headers -/Source/drivers/*.h diff --git a/Dn-help b/Dn-help index 010d5787..71630dc8 160000 --- a/Dn-help +++ b/Dn-help @@ -1 +1 @@ -Subproject commit 010d57878a5a83d1e8de434bcc9b9f9597a5e95c +Subproject commit 71630dc8ba01799f7a6ab1ef2c16aaf17f4df818 diff --git a/Source/APU/N163.cpp b/Source/APU/N163.cpp index 339c241a..5eb33e4a 100644 --- a/Source/APU/N163.cpp +++ b/Source/APU/N163.cpp @@ -84,11 +84,16 @@ uint8_t CN163::Read(uint16_t Address, bool &Mapped) void CN163::Process(uint32_t Time, Blip_Buffer& Output) { // Mix level will dynamically change based on number of channels - if (!m_UseSurveyMix) { - int channels = m_N163.GetNumberOfChannels(); + auto channels = m_N163.GetNumberOfChannels(); + auto scale = m_bUseLinearMixing ? (channels + 1) : 1; + + if (m_UseSurveyMix) { + m_SynthN163.volume(m_Attenuation, 225 * scale); + } + else { double N163_volume = (channels == 0) ? 1.3f : (1.5f + float(channels) / 1.5f); N163_volume *= m_Attenuation; - m_SynthN163.volume(N163_volume * 1.1, 1600); + m_SynthN163.volume(N163_volume * 1.1, 1600 * scale); } uint32_t now = 0; @@ -199,9 +204,8 @@ void CN163::UpdateMixLevel(double v, bool UseSurveyMix) { m_Attenuation = v; m_UseSurveyMix = UseSurveyMix; - if (UseSurveyMix) - m_SynthN163.volume(m_Attenuation, 225); - // Legacy mixing recalculates chip levels at runtime + // Recalculate chip levels at runtime; this is dependent on the amount of + // N163 channels at execution. } void CN163::Log(uint16_t Address, uint8_t Value) // // // diff --git a/Source/APU/mesen/Namco163Audio.h b/Source/APU/mesen/Namco163Audio.h index 5f531f54..2b64ed6c 100644 --- a/Source/APU/mesen/Namco163Audio.h +++ b/Source/APU/mesen/Namco163Audio.h @@ -131,7 +131,7 @@ class Namco163Audio for (int i = 7, min = 7 - GetNumberOfChannels(); i >= min; i--) { summedOutput += _channelOutput[i]; } - summedOutput /= (GetNumberOfChannels() + 1); + // Adjust the volume range on the blip_synth! return (_mixLinear ? summedOutput : _channelOutput[_currentChannel]); } diff --git a/Source/AboutDlg.cpp b/Source/AboutDlg.cpp index ff95b5c5..54371816 100644 --- a/Source/AboutDlg.cpp +++ b/Source/AboutDlg.cpp @@ -168,7 +168,7 @@ BOOL CAboutDlg::OnInitDialog() _T("- Sunsoft 5B information in manual by forple\r\n") // // !! _T("- Additional manual information by Persune\r\n") // // !! _T("- Toolbar icons are made by ilkke\r\n") - _T("- Dn-FT icon design by Pale Moon\r\n") // // !! + _T("- Dn-FT icon design by Sun Rays\r\n") // // !! _T("- DPCM import resampler by Jarhmander\r\n") _T("- DPCM sample bit order reverser mod by Persune\r\n") // // !! _T("- Module text import/export by rainwarrior")); // // // diff --git a/Source/Channels2A03.cpp b/Source/Channels2A03.cpp index 3617a4dc..3cc4c13d 100644 --- a/Source/Channels2A03.cpp +++ b/Source/Channels2A03.cpp @@ -354,10 +354,11 @@ bool CTriangleChan::HandleEffect(effect_t EffNum, unsigned char EffParam) m_bResetEnvelope = true; } else { - m_bEnvelopeLoop = true; + // Avoid touching the envelope loop flag if under a retrigger effect + if (!m_bRetrigger) + m_bEnvelopeLoop = true; return CChannelHandler2A03::HandleEffect(EffNum, EffParam); // true } - m_bRetrigger = false; break; case EF_RETRIGGER: if (EffParam > 0x7f) diff --git a/Source/Compiler.cpp b/Source/Compiler.cpp index b5dd4f18..4f50a1da 100644 --- a/Source/Compiler.cpp +++ b/Source/Compiler.cpp @@ -116,6 +116,7 @@ const int CCompiler::FLAG_LINEARPITCH = 1 << 2; // // // // chan_id_t to ft_channel_enable index +// TODO: utilize WriteChannelMap() ? const size_t CH_MAP[] = { 0, 1, 2, 3, 27, // 2A03 6, 7, 8, // VRC6 diff --git a/Source/FamiTrackerDoc.cpp b/Source/FamiTrackerDoc.cpp index 91cdc198..96901a88 100644 --- a/Source/FamiTrackerDoc.cpp +++ b/Source/FamiTrackerDoc.cpp @@ -807,7 +807,6 @@ BOOL CFamiTrackerDoc::SaveDocument(LPCTSTR lpszPathName) const bool CFamiTrackerDoc::WriteBlocks(CDocumentFile *pDocFile) const { static const int DEFAULT_BLOCK_VERSION[] = { // // // TODO: use version info -#ifdef TRANSPOSE_FDS // internal 6, // Parameters 1, // Song Info @@ -816,21 +815,14 @@ bool CFamiTrackerDoc::WriteBlocks(CDocumentFile *pDocFile) const 6, // Instruments 6, // Sequences 3, // Frames - 5, // Patterns - 1, // DSamples - 1, // Comments + // Patterns +#ifdef TRANSPOSE_FDS + 5, #else - 6, // Parameters - 1, // Song Info - 0, // Tuning - 3, // Header - 6, // Instruments - 6, // Sequences - 3, // Frames - 4, // Patterns + 4, +#endif 1, // DSamples 1, // Comments -#endif // expansion 6, // SequencesVRC6 1, // SequencesN163 diff --git a/Source/InstrumentEditDlg.cpp b/Source/InstrumentEditDlg.cpp index 5ce2b8ae..27d74256 100644 --- a/Source/InstrumentEditDlg.cpp +++ b/Source/InstrumentEditDlg.cpp @@ -165,7 +165,7 @@ void CInstrumentEditDlg::ClearPanels() m_iInstrument = -1; } -void CInstrumentEditDlg::SetCurrentInstrument(int Index) +void CInstrumentEditDlg::SetCurrentInstrument(int Index, bool Focus) { CFamiTrackerDoc *pDoc = CFamiTrackerDoc::GetDoc(); std::shared_ptr pInstrument = pDoc->GetInstrument(Index); @@ -220,6 +220,7 @@ void CInstrumentEditDlg::SetCurrentInstrument(int Index) for (int i = 0; i < PANEL_COUNT; ++i) { if (m_pPanels[i] != NULL) { m_pPanels[i]->SelectInstrument(pInstrument); + if (Focus) m_pPanels[i]->SetFocus(); } } diff --git a/Source/InstrumentEditDlg.h b/Source/InstrumentEditDlg.h index 33d340a1..d0e9eee5 100644 --- a/Source/InstrumentEditDlg.h +++ b/Source/InstrumentEditDlg.h @@ -34,7 +34,7 @@ class CInstrumentEditDlg : public CDialog virtual ~CInstrumentEditDlg(); void ChangeNoteState(int Note); - void SetCurrentInstrument(int Index); + void SetCurrentInstrument(int Index, bool Focus = true); float GetRefreshRate() const; // // // void SetRefreshRate(float Rate); // // // bool IsOpened() const; diff --git a/Source/InstrumentEditorSeq.cpp b/Source/InstrumentEditorSeq.cpp index 0c96e5fc..9bb8204d 100644 --- a/Source/InstrumentEditorSeq.cpp +++ b/Source/InstrumentEditorSeq.cpp @@ -75,8 +75,6 @@ void CInstrumentEditorSeq::SelectInstrument(std::shared_ptr pInst) SetDlgItemInt(IDC_SEQ_INDEX, m_pInstrument->GetSeqIndex(m_iSelectedSetting = Sel)); SelectSequence(m_pInstrument->GetSeqIndex(m_iSelectedSetting), m_iSelectedSetting); - - SetFocus(); } void CInstrumentEditorSeq::SelectSequence(int Sequence, int Type) diff --git a/Source/MainFrm.cpp b/Source/MainFrm.cpp index be0036db..f1df202b 100644 --- a/Source/MainFrm.cpp +++ b/Source/MainFrm.cpp @@ -995,7 +995,8 @@ void CMainFrame::SelectInstrument(int Index) // Update instrument editor if (m_wndInstEdit.IsOpened()) - m_wndInstEdit.SetCurrentInstrument(Index); + // Do not shift focus when selecting the instrument due to a instrument column edit + m_wndInstEdit.SetCurrentInstrument(Index, false); } else { // Remove selection diff --git a/Source/drivers/asm/apu.s b/Source/drivers/asm/apu.s index 86c9dbe3..70395cc9 100644 --- a/Source/drivers/asm/apu.s +++ b/Source/drivers/asm/apu.s @@ -236,17 +236,11 @@ ft_update_2a03: beq @KillTriangle lda var_ch_Note + APU_TRI beq @KillTriangle - lda var_ch_LengthCounter + APU_TRI ;;; ;; ; - and #%00000111 - beq :++ ; branch if no length counter and no linear counter -: lda var_Linear_Counter - and #$7F - bpl :++ ; always -: lda var_Triangle_Trill ; still write linear counter if we have retriggering enabled - bne :-- + + ; linear counter is already processed at this point lda var_Linear_Counter - ora #$80 ; ;; ;;; -: sta $4008 + sta $4008 + @EndTriangleVolume: ; Period table isn't limited to $7FF anymore lda var_ch_PeriodCalcHi + APU_TRI diff --git a/Source/drivers/asm/build/build_engine.py b/Source/drivers/asm/build/build_engine.py index e135bf11..2431f69f 100644 --- a/Source/drivers/asm/build/build_engine.py +++ b/Source/drivers/asm/build/build_engine.py @@ -10,10 +10,13 @@ parser = argparse.ArgumentParser() parser.add_argument("-d", "--debug", action="store_true") +parser.add_argument("-n", "--no-nsfdrv", action="store_true") args = parser.parse_args() DEBUG = args.debug +HEADERLESS = args.no_nsfdrv + def resolvelabel(label: str) -> str: match label: case "ft_vibrato_table": @@ -37,26 +40,40 @@ def resolvelabel(label: str) -> str: def build(chip: str): print("Building NSF driver for " + chip + "...") + package = "" if HEADERLESS else "-D PACKAGE" + hdrless = "_hdrless" if HEADERLESS else "" + # compile assembly to object - out = subprocess.run(f"ca65 ../driver.s -l out_{chip}.lst \ - -D USE_{chip} -D NAMCO_CHANNELS=8 -D PACKAGE \ + out = subprocess.run(f"ca65 ../driver.s -l out_{chip}{hdrless}.lst \ + -D USE_{chip} -D NAMCO_CHANNELS=8 \ -D RELOCATE_MUSIC -D USE_BANKSWITCH -D USE_OLDVIBRATO \ - -D USE_LINEARPITCH -o driver_{chip}.o", + -D USE_LINEARPITCH {package} -o driver_{chip}{hdrless}.o", shell=True, capture_output=True, text=True) print(out.stdout, end="") print(out.stderr, end="") # compile object with shifted memory config to determine pointer locations - out = subprocess.run(f"ld65 -o c0_{chip}.bin driver_{chip}.o -C c0.cfg", + out = subprocess.run(f"ld65 -o c0_{chip}{hdrless}.bin \ + driver_{chip}{hdrless}.o -C c0.cfg", shell=True, capture_output=True, text=True) print(out.stdout, end="") print(out.stderr, end="") - out = subprocess.run(f"ld65 -o c1_{chip}.bin driver_{chip}.o -C c1.cfg", + out = subprocess.run(f"ld65 -o c1_{chip}{hdrless}.bin \ + driver_{chip}{hdrless}.o -C c1.cfg", shell=True, capture_output=True, text=True) print(out.stdout, end="") print(out.stderr, end="") + # headerless NSF kernel binary not supported + if HEADERLESS: + print("debug: NSF kernel binary not supported") + os.remove(f"out_{chip}{hdrless}.lst") + os.remove(f"c0_{chip}{hdrless}.bin") + os.remove(f"c1_{chip}{hdrless}.bin") + os.remove(f"driver_{chip}{hdrless}.o") + return + adr = {} pos = {} reloc_lo = {} diff --git a/Source/drivers/asm/driver.s b/Source/drivers/asm/driver.s index 1daf186f..38eecfa2 100644 --- a/Source/drivers/asm/driver.s +++ b/Source/drivers/asm/driver.s @@ -493,8 +493,8 @@ PLAY: USE_PADJMP = 1 ; disable if you don't need FDS write protection ;; -; manually define a jump command as an optimization -.macro jmppadjmp jump, count, startpad, endpad, condition +; manually define a jump command before padding as an optimization +.macro jmppad jump, count, startpad, endpad, condition .if (count > 3) && condition && USE_PADJMP .assert * = LOAD+((startpad-$8000) & $FFFF), ldwarning, .sprintf("padding does not start at $%04X", startpad) jump @@ -515,7 +515,7 @@ USE_PADJMP = 1 ; disable if you don't need FDS write protection .macro padjmp count, startpad, endpad, condition .if (count > 3) && condition && USE_PADJMP .local end - jmppadjmp {jmp end}, count, startpad, endpad, condition + jmppad {jmp end}, count, startpad, endpad, condition end: .endif .endmacro diff --git a/Source/drivers/asm/effects.s b/Source/drivers/asm/effects.s index 34d4ffc5..c8485832 100644 --- a/Source/drivers/asm/effects.s +++ b/Source/drivers/asm/effects.s @@ -186,21 +186,20 @@ ft_load_slide: ; FDS's frequency reg is inverted cpx #FDS_OFFSET bne :++ + cmp #EFF_SLIDE_UP + bne :+ ; FDS scratch write padding padjmp 8, $8FFC, $9003, .defined(USE_ALL) && .defined(PACKAGE) - cmp #EFF_SLIDE_UP - bne :+ lda #EFF_SLIDE_DOWN ; FDS scratch write padding - jmppadjmp {jmp :++}, 7, $900A, $9010, .defined(USE_ALL) && .defined(PACKAGE) + jmppad {jmp :++}, 11, $9006, $9010, .defined(USE_ALL) && .defined(PACKAGE) +: lda #EFF_SLIDE_UP ; FDS scratch write padding - jmppadjmp {jmp :++}, 7, $8FFD, $9003, .defined(USE_ALL) && (.not .defined(PACKAGE)) - -: lda #EFF_SLIDE_UP + padjmp 9, $8FFB, $9003, .defined(USE_ALL) && (.not .defined(PACKAGE)) : .endif @@ -208,12 +207,12 @@ ft_load_slide: ; Work-around for noise lda ft_channel_type, x ;;; ;; ; +.if .defined(USE_N163) + cpx #CHAN_N163 ; FDS scratch write padding padjmp 5, $900C, $9010, .defined(USE_ALL) && (.not .defined(PACKAGE)) -.if .defined(USE_N163) - cpx #CHAN_N163 beq @Invert .endif cpx #CHAN_NOI @@ -223,17 +222,17 @@ ft_load_slide: cmp #EFF_SLIDE_UP beq :+ lda #EFF_SLIDE_UP + sta var_ch_Effect, x ; FDS scratch write padding padjmp 4, $902D, $9030, .defined(USE_ALL) && .defined(PACKAGE) - sta var_ch_Effect, x : lda #EFF_SLIDE_DOWN sta var_ch_Effect, x : ; FDS scratch write padding - jmppadjmp {jmp ft_jump_to_effect}, 7, $902A, $9030, .defined(USE_ALL) && (.not .defined(PACKAGE)) + jmppad {jmp ft_jump_to_effect}, 9, $9028, $9030, .defined(USE_ALL) && (.not .defined(PACKAGE)) ; see CChannelHandler::CalculatePeriod() ft_calc_period: @@ -486,33 +485,35 @@ ft_calc_period: ; ft_portamento: lda var_ch_EffParam, x ; Check portamento, if speed > 0 - jeq @NoPortamento + jeq ft_slide_done lda var_ch_PortaToLo, x ; and if freq > 0, else stop ora var_ch_PortaToHi, x - jeq @NoPortamento + jeq ft_slide_done lda var_ch_TimerPeriodHi, x ; Compare high byte cmp var_ch_PortaToHi, x - bcc @Increase - bne @Decrease + jcc ft_slide_up + jne ft_slide_down lda var_ch_TimerPeriodLo, x ; Compare low byte cmp var_ch_PortaToLo, x - bcc @Increase - bne @Decrease + jcc ft_slide_up + jne ft_slide_down ;rts ; done jmp ft_post_effects -@Decrease: ; Decrease period +ft_portamento_up: + lda var_ch_Note, x + jeq ft_post_effects lda var_ch_EffParam, x sta var_Temp16 lda #$00 sta var_Temp16 + 1 .if .defined(USE_N163) -.if .defined(USE_LINEARPITCH) +.if .defined(USE_LINEARPITCH) ;; !! !! lda var_SongFlags and #FLAG_LINEARPITCH bne :+ ;; !! !! only apply N163 pitch slide shift when linear pitch is disabled - ; see CChannelHandlerN163::SetupSlide() + ; see CChannelHandlerN163::HandleEffect() .endif lda ft_channel_type, x cmp #CHAN_N163 @@ -525,29 +526,11 @@ ft_portamento: : .endif jsr ft_period_remove - -.if 0 - sec - lda var_ch_TimerPeriodLo, x - sbc var_ch_EffParam, x - sta var_ch_TimerPeriodLo, x - lda var_ch_TimerPeriodHi, x - sbc #$00 - sta var_ch_TimerPeriodHi, x -.endif - ; Check if sign bit has changed, if so load the desired period -; lda var_ch_TimerPeriodHi, x ; Compare high byte - cmp var_ch_PortaToHi, x - bcc @LoadPeriod - bmi @LoadPeriod - bne @NoPortamento - lda var_ch_TimerPeriodLo, x ; Compare low byte - cmp var_ch_PortaToLo, x - bcc @LoadPeriod -; rts ; Portamento is done at this point + jsr ft_limit_freq jmp ft_post_effects - -@Increase: ; Increase period +ft_portamento_down: + lda var_ch_Note, x + jeq ft_post_effects lda var_ch_EffParam, x sta var_Temp16 lda #$00 @@ -558,7 +541,7 @@ ft_portamento: and #FLAG_LINEARPITCH bne :+ ;; !! !! only apply N163 pitch slide shift when linear pitch is disabled - ; see CChannelHandlerN163::SetupSlide() + ; see CChannelHandlerN163::HandleEffect() .endif lda ft_channel_type, x cmp #CHAN_N163 @@ -571,48 +554,51 @@ ft_portamento: : .endif jsr ft_period_add -.if 0 + jsr ft_limit_freq + jmp ft_post_effects + +ft_period_add: clc lda var_ch_TimerPeriodLo, x - adc var_ch_EffParam, x + adc var_Temp16 sta var_ch_TimerPeriodLo, x lda var_ch_TimerPeriodHi, x - adc #$00 + adc var_Temp16 + 1 sta var_ch_TimerPeriodHi, x -.endif - ; Check if sign bit has changed, if so load the desired period - lda var_ch_PortaToHi, x ; Compare high byte - cmp var_ch_TimerPeriodHi, x - bcc @LoadPeriod - bne @NoPortamento - lda var_ch_PortaToLo, x ; Compare low byte - cmp var_ch_TimerPeriodLo, x - bcc @LoadPeriod -; rts - jmp ft_post_effects - -@LoadPeriod: ; Load the correct period - lda var_ch_PortaToLo, x + bcc :+ ; Do not wrap + lda #$FF sta var_ch_TimerPeriodLo, x - lda var_ch_PortaToHi, x sta var_ch_TimerPeriodHi, x -@NoPortamento: - jmp ft_post_effects +: rts +ft_period_remove: + sec + lda var_ch_TimerPeriodLo, x + sbc var_Temp16 + sta var_ch_TimerPeriodLo, x + lda var_ch_TimerPeriodHi, x + sbc var_Temp16 + 1 + sta var_ch_TimerPeriodHi, x + bcs :+ ; Do not wrap + lda #$00 + sta var_ch_TimerPeriodLo, x + sta var_ch_TimerPeriodHi, x +: rts -ft_portamento_up: - lda var_ch_Note, x - beq :+ +; +; Note slides +; +ft_slide_up: lda var_ch_EffParam, x sta var_Temp16 lda #$00 sta var_Temp16 + 1 .if .defined(USE_N163) -.if .defined(USE_LINEARPITCH) ;; !! !! +.if .defined(USE_LINEARPITCH) lda var_SongFlags and #FLAG_LINEARPITCH bne :+ ;; !! !! only apply N163 pitch slide shift when linear pitch is disabled - ; see CChannelHandlerN163::HandleEffect() + ; see CChannelHandlerN163::SetupSlide() .endif lda ft_channel_type, x cmp #CHAN_N163 @@ -624,23 +610,31 @@ ft_portamento_up: rol var_Temp16 + 1 : .endif - jsr ft_period_remove - jsr ft_limit_freq + jsr ft_period_add + + ; Check if sign bit has changed, if so load the desired period + lda var_ch_PortaToHi, x ; Compare high byte + cmp var_ch_TimerPeriodHi, x + bcc ft_slide_done + bne ft_slide_not_done + lda var_ch_PortaToLo, x ; Compare low byte + cmp var_ch_TimerPeriodLo, x + bcc ft_slide_done +; rts jmp ft_post_effects -ft_portamento_down: - lda var_ch_Note, x - beq :+ + +ft_slide_down: lda var_ch_EffParam, x sta var_Temp16 lda #$00 sta var_Temp16 + 1 .if .defined(USE_N163) .if .defined(USE_LINEARPITCH) + ;; !! !! only apply N163 pitch slide shift when linear pitch is disabled + ; see CChannelHandlerN163::SetupSlide() lda var_SongFlags and #FLAG_LINEARPITCH bne :+ - ;; !! !! only apply N163 pitch slide shift when linear pitch is disabled - ; see CChannelHandlerN163::HandleEffect() .endif lda ft_channel_type, x cmp #CHAN_N163 @@ -652,74 +646,18 @@ ft_portamento_down: rol var_Temp16 + 1 : .endif - jsr ft_period_add - jsr ft_limit_freq - jmp ft_post_effects - -ft_period_add: - clc - lda var_ch_TimerPeriodLo, x - adc var_Temp16 - sta var_ch_TimerPeriodLo, x - lda var_ch_TimerPeriodHi, x - adc var_Temp16 + 1 - sta var_ch_TimerPeriodHi, x - bcc :+ ; Do not wrap - lda #$FF - sta var_ch_TimerPeriodLo, x - sta var_ch_TimerPeriodHi, x -: rts -ft_period_remove: - sec - lda var_ch_TimerPeriodLo, x - sbc var_Temp16 - sta var_ch_TimerPeriodLo, x - lda var_ch_TimerPeriodHi, x - sbc var_Temp16 + 1 - sta var_ch_TimerPeriodHi, x - bcs :+ ; Do not wrap - lda #$00 - sta var_ch_TimerPeriodLo, x - sta var_ch_TimerPeriodHi, x -: rts + jsr ft_period_remove -.if 0 -; -; Note slide -; -ft_slide_up: - sec - lda var_ch_TimerPeriodLo, x - sbc var_ch_EffParam, x - sta var_ch_TimerPeriodLo, x - lda var_ch_TimerPeriodHi, x - sbc #$00 - sta var_ch_TimerPeriodHi, x - bmi ft_slide_done - cmp var_ch_PortaToHi, x ; Compare high byte + ; Check if sign bit has changed, if so load the desired period +; lda var_ch_TimerPeriodHi, x ; Compare high byte + cmp var_ch_PortaToHi, x bcc ft_slide_done + bmi ft_slide_done bne ft_slide_not_done - lda var_ch_TimerPeriodLo, x - cmp var_ch_PortaToLo, x ; Compare low byte + lda var_ch_TimerPeriodLo, x ; Compare low byte + cmp var_ch_PortaToLo, x bcc ft_slide_done - - jmp ft_post_effects - -ft_slide_down: - clc - lda var_ch_TimerPeriodLo, x - adc var_ch_EffParam, x - sta var_ch_TimerPeriodLo, x - lda var_ch_TimerPeriodHi, x - adc #$00 - sta var_ch_TimerPeriodHi, x - - cmp var_ch_PortaToHi, x ; Compare high byte - bcc ft_slide_not_done - bne ft_slide_done - lda var_ch_TimerPeriodLo, x - cmp var_ch_PortaToLo, x ; Compare low byte - bcs ft_slide_done +; rts ; Portamento is done at this point jmp ft_post_effects ft_slide_done: @@ -735,7 +673,6 @@ ft_slide_done: ft_slide_not_done: jmp ft_post_effects -.endif ; ; Arpeggio diff --git a/Source/drivers/asm/instrument.s b/Source/drivers/asm/instrument.s index 958fca0d..723219b5 100644 --- a/Source/drivers/asm/instrument.s +++ b/Source/drivers/asm/instrument.s @@ -189,13 +189,13 @@ ft_run_instrument: sta var_Temp16 bpl @PositivePitch @NegativePitch: - ;; !! !! change the sign + ;; !! !! change the sign ;; this is stupid, but what more can i do ;; we could easily just use the same addition macro ;; but the code explicitly checks for overflow - lda #$FF - eor var_Temp16 - sta var_Temp16 + lda #$FF + eor var_Temp16 + sta var_Temp16 inc var_Temp16 jsr ft_period_remove jmp :+ diff --git a/Source/drivers/asm/player.s b/Source/drivers/asm/player.s index efd68e19..cc5123e5 100644 --- a/Source/drivers/asm/player.s +++ b/Source/drivers/asm/player.s @@ -1030,14 +1030,15 @@ ft_cmd_note_cut: cmp #CHAN_TRI ;;; ;; ; bne :+ ; linear counter + ; Avoid touching the envelope loop flag if under a retrigger effect + lda var_Triangle_Trill + bne :+ lda var_Linear_Counter ora #$80 sta var_Linear_Counter lda var_ch_LengthCounter + APU_TRI and #%11111000 sta var_ch_LengthCounter + APU_TRI ; ;; ;;; - lda #0 - sta var_Triangle_Trill : rts ft_cmd_linear_counter: ;;; ;; ; jsr ft_get_pattern_byte @@ -1045,8 +1046,6 @@ ft_cmd_linear_counter: ;;; ;; ; lda var_ch_LengthCounter + APU_TRI ora #%00000001 sta var_ch_LengthCounter + APU_TRI - lda #0 - sta var_Triangle_Trill rts ; ;; ;;; ;;; ;; ; Effect: Note release (Lxx) ft_cmd_note_release: @@ -1113,7 +1112,7 @@ ft_cmd_retrigger: jsr ft_get_pattern_byte sta var_ch_DPCM_Retrig lda var_ch_DPCM_RetrigCntr - bne :++ + bne :+++ lda var_ch_DPCM_Retrig sta var_ch_DPCM_RetrigCntr : @@ -1554,8 +1553,8 @@ ft_translate_freq: .if .defined(USE_DPCM) StoreDPCM: ; Special case for DPCM - clc ; Multiply the DPCM instrument index by 3 - pla ; and store in Temp16 + clc ; Multiply the DPCM instrument index by 3 + pla ; and store in Temp16 pha asl a adc var_dpcm_inst_list @@ -1579,7 +1578,7 @@ StoreDPCM: ; Special case for DPCM iny lda var_ch_DPCMDAC bpl :+ - lda (var_Temp16), y ; Read delta value + lda (var_Temp16), y ; Read delta value bmi :+ sta var_ch_DPCMDAC : iny diff --git a/Source/drivers/asm/vrc7.s b/Source/drivers/asm/vrc7.s index 1fd8a4d9..104ecf2b 100644 --- a/Source/drivers/asm/vrc7.s +++ b/Source/drivers/asm/vrc7.s @@ -398,14 +398,17 @@ ft_vrc7_get_freq: lda #$80 ; Indicate new note (no previous) sta var_ch_vrc7_OldOctave - jmp :+ + ; FDS scratch write padding + jmppad {jmp :+}, 7, $9FFC, $A002, .defined(USE_ALL) && .defined(PACKAGE) + + ; jmp :+ @NoPorta: lda ft_note_table_vrc7_l, y sta var_ch_TimerPeriodLo, x ; FDS scratch write padding - padjmp 6, $9FFD, $A002, .defined(USE_ALL) && .defined(PACKAGE) + padjmp 6, $9FFD, $A002, .defined(USE_ALL) && (.not .defined(PACKAGE)) lda ft_note_table_vrc7_h, y sta var_ch_TimerPeriodHi, x @@ -414,10 +417,6 @@ ft_vrc7_get_freq: sta var_ch_vrc7_Bnum - VRC7_OFFSET, x pla - - ; FDS scratch write padding - padjmp 6, $9FFD, $A002, .defined(USE_ALL) && (.not .defined(PACKAGE)) - tay jmp ft_set_trigger @@ -431,7 +430,6 @@ ft_vrc7_get_freq_only: lda var_ch_vrc7_ActiveNote - VRC7_OFFSET, x jsr ft_translate_note_vrc7 tay - lda ft_note_table_vrc7_l, y sta var_ch_TimerPeriodLo, x lda ft_note_table_vrc7_h, y diff --git a/Source/drivers/build.cmd b/Source/drivers/build.cmd index 871378d7..5eca26ed 100644 --- a/Source/drivers/build.cmd +++ b/Source/drivers/build.cmd @@ -4,7 +4,7 @@ cd %~dp0 set drivers=%cd% cd asm\build || goto :error -python build_engine.py %1 || goto :error +python build_engine.py %1 %2 || goto :error copy drivers\* %drivers%\ || goto :error rmdir /s /q drivers || goto :error goto :EOF diff --git a/Source/libsamplerate/libsamplerate.vcxproj b/Source/libsamplerate/libsamplerate.vcxproj index 0255d1da..e25ef257 100644 --- a/Source/libsamplerate/libsamplerate.vcxproj +++ b/Source/libsamplerate/libsamplerate.vcxproj @@ -39,7 +39,7 @@ Win32Proj {5b4c1aa7-4ae9-4ff2-a7e6-8eee50edc6e2} libsamplerate - 10.0.20348.0 + 10.0.26100.0