Thank you for the reply. Here is the sound code I am using (please remember, it's adapted from the TIA driver I use):
First, here is a video of the sound in FamiTracker, then what I get when I use 'Mode 0', and then 'Mode 1':
https://youtu.be/UUA6iNb8gFUThe sounds I will eventually try to replicate (once I figure this example out) are attached.
Code:
; TUNE ROUTINES ------------------------------------------------------------------------------------------------------------>
AUDC0T EQU $4000 ;Audio Control / Volume Channel 0
AUDF0T EQU $4002 ;Audio Frequency Channel 0
; INITIALIZE SOUND HARDWARE
INITTUN
LDA #$1F ;ENABLE ALL CHANNELS (SQUARE1, SQUARE2, TRIANGLE, NOISE, DIGITAL)
STA $4015
LDA #$00 ;SILENCE ALL CHANNELS
STA AUDF0T+$00
STA AUDC0T+$00
STA AUDF0T+$04
STA AUDC0T+$04
STA AUDF0T+$08
STA AUDC0T+$08
STA AUDF0T+$0C
STA AUDC0T+$0C
RTS
; TURN OFF ALL SOUNDS
STOPTUN
LDA #$00 ;TURN OFF SOUNDS
STA AUDF0T+$00
STA AUDC0T+$00
STA AUDF0T+$04
STA AUDC0T+$04
STA AUDF0T+$08
STA AUDC0T+$08
STA AUDF0T+$0C
STA AUDC0T+$0C
LDA #$01
STA TUNOFF
RTS
; TURN ON ALL SOUNDS
STARTTUN
LDA #$00
STA TUNOFF
RTS
; THIS ROUTINE ERASES ALL TUNES
; X AND Y ARE PRESERVED
CLEARTUN
TXA ;STACK REGISTERS
PHA
TYA
PHA
LDX #$03
CTLOOP
JSR ENDTUNE ;ERASE CURRENT TUNE
DEX
BPL CTLOOP
PLA ;UNSTACK REGISTERS
TAY
PLA
TAX
RTS
; ROUTINE TO KILL A PARTICULAR TUNE - IF IT IS RUNNING
; INPUT: TUNE NUMBER IN A
; X AND Y ARE PRESERVED
KILLTUNE
STA TUNNUM ;SAVE IT
TXA ;STACK REGISTERS
PHA
TYA
PHA
LDX #$03 ;CHECK ALL CHANNELS
KTLOOP
LDA TUNON,X ;SEE IF CHANNEL ON
BEQ KTNEXT
LDA TUNINDEX,X ;SEE IF HAS TUNE TO BE KILLED
CMP TUNNUM
BNE KTNEXT
JSR ENDTUNE ;ERASE IT
KTNEXT
DEX
BPL KTLOOP
PLA ;UNSTACK REGISTERS
TAY
PLA
TAX
RTS
; THIS ROUTINE CLEARS OUT A TUNE CHANNEL
; INPUT: X IS CHANNEL
ENDTUNE
LDA #$00
STA TUNON,X ;INDICATE CHANNEL CLEAR
STA TUNINDEX,X ;CLEAR TUNE INDEX
TXA
ASL A
ASL A
TAY
LDA #$00
STA AUDF0T,Y ;SILENCE THE CHANNEL
STA AUDC0T,Y
RTS
; THIS ROUTINE ENTERS A TUNE INTO ONE OF THE SOUND CHANNELS IF IT CAN
; INPUT: TUNE NUMBER IN A
; X AND Y ARE PRESERVED
DOTUNE
BMI DTEXIT ;$FF MEANS NO TUNE (FOR TABLE READS)
STA TUNNUM ;SAVE IT
;LDA AUTOPLAY ;IF IN AUTOPLAY - NO SOUND
;BEQ DTCONT
;RTS
DTCONT
TXA ;STACK REGISTERS
PHA
TYA
PHA
LDY TUNNUM ;SEE IF WE CAN PUT IT IN
LDX TUNCHANNL,Y ;GET WHAT CHANNEL TO TRY TO PUT IT IN
LDA TUNON,X ;SEE IF CHANNEL OPEN
BEQ DTDOIT
LDA TUNPRIRTY,Y ;SEE IF WE CAN BUMP CHANNEL
CMP TUNPRIOR,X
BMI DTOUT
DTDOIT
LDA TUNNUM
TAY ;PUT TUNE IN Y
STA TUNINDEX,X ;SET THE TUNE INDEX
LDA #$00 ;TURN TUNE OFF WHILE CHANGING IT
STA TUNON,X
LDA TUNLOWFRQL,Y ;GET LOW BYTE OF FREQUENCY LOW ADDRESS
STA LOWFRQL,X
LDA TUNLOWFRQH,Y ;GET LOW BYTE OF FREQUENCY HIGH ADDRESS
STA LOWFRQH,X
LDA TUNFRMFRQL,Y ;GET TUNE DURATION AND FREQUENCY LOW ADDRESS
STA FRMFRQL,X
LDA TUNFRMFRQH,Y ;GET TUNE DURATION AND FREQUENCY HIGH ADDRESS
STA FRMFRQH,X
LDA TUNCTLVOLL,Y ;GET TUNE CNTL AND VOLUME LOW ADDRESS
STA CTLVOLL,X
LDA TUNCTLVOLH,Y ;GET TUNE CNTL AND VOLUME HIGH ADDRESS
STA CTLVOLH,X
LDA TUNPRIRTY,Y ;SET PRIORITY
STA TUNPRIOR,X
LDA #$01 ;SET FREQ, CTL, AND VOL TO BE SET
STA TUNFRM,X
STA TUNON,X ;AND TURN THE TUNE ON!
DTOUT
PLA ;UNSTACK REGISTERS
TAY
PLA
TAX
DTEXIT
RTS
; THIS ROUTINE IS CALLED EVERY VBLANK TO TAKE CARE OF TUNES
; REGISTERS ARE NOT SAVED
TUNER
LDX #$03 ;TWO TUNES CHANNELS, START WITH LAST
LDA TUNOFF
BEQ TUNLOOP
RTS
TUNLOOP
LDA TUNON,X
BNE TUNBODY
TXA
ASL A
ASL A
TAY
LDA #$00
STA AUDC0T,Y ;IF THE CHANNEL IS OFF - MAKE SURE VOLUME IS OFF
JMP TUNNEXT
TUNBODY
DEC TUNFRM,X ;SEE IF WE'RE DONE WITH THIS SOUND
BEQ TUNCTLVOL
JMP TUNNEXT ;NOPE, CONTINUE
TUNCTLVOL
LDA CTLVOLL,X ;GET THE CURRENT DUTY CYCLE / VOLUME BYTE
STA SOUNDZP
LDA CTLVOLH,X
STA SOUNDZP+1
LDY #$00
LDA [SOUNDZP],Y
BEQ TUNEND ;$00 HERE MEANS END OF TUNE
ORA #$30 ;FORCE BITS 4 AND 5 TO BE ON (WE CONTROL FRAMES AND VOLUME)
PHA
TXA ;MAKE 'Y' AN INDEX INTO THE SOUND REGISTERS
ASL A
ASL A
TAY
PLA
STA AUDC0T,Y ;STORE CONTROL
INC CTLVOLL,X
BNE TUNFRMFRQ
INC CTLVOLH,X
TUNFRMFRQ
LDY #$00
LDA LOWFRQL,X ;GET THE LOW PERIOD ADDRESS
STA SOUNDZP
LDA LOWFRQH,X
STA SOUNDZP+1
LDA [SOUNDZP],Y ;NOW GET THE LOW BYTE OF THE PERIOD
STA SOUNDTEMP
LDA FRMFRQL,X ;GET THE DURATION / HIGH PERIOD ADDRESS
STA SOUNDZP
LDA FRMFRQH,X
STA SOUNDZP+1
LDA [SOUNDZP],Y ;GET THE CURRENT DURATION / HIGH PERIOD BYTE
STA SOUNDTEMP+1
TXA ;MAKE 'Y' AN INDEX INTO THE SOUND REGISTERS
ASL A
ASL A
TAY
LDA SOUNDTEMP
STA AUDF0T,Y ;STORE FREQUENCY
LDA SOUNDTEMP+1
CPX #$03 ;WE NEED TO WRITE A DUMMY VALUE TO $400F IF WE ARE ON THE NOISE CHANNEL
BNE TUNNOTANOISE
LDA #$01
TUNNOTANOISE
AND #$07 ;GET LOW THREE BITS OF THE HIGH FREQUENCY BYTE
STA AUDF0T+1,Y
CPX #$02 ;IF TRIANGLE OR NOISE, SKIP THIS PART
BPL TUNSKIPTN
LDA #$08
STA AUDC0T+1,Y
TUNSKIPTN
LDA SOUNDTEMP+1 ;NOW EXTRACT THE NUMBER OF FRAMES
LSR A
LSR A
LSR A
STA TUNFRM,X ;STORE DURATION (IN FRAMES)
INC TUNFRM,X ;WE NEED THIS BECAUSE THE DURATION GETS DECREMENTED FIRST
INC LOWFRQL,X
BNE TUNNXT1
INC LOWFRQH,X
TUNNXT1
INC FRMFRQL,X
BNE TUNNEXT
INC FRMFRQH,X
TUNNEXT
DEX
BMI TUNEXIT
JMP TUNLOOP
TUNEXIT
RTS
TUNEND
LDA FRMFRQL,X ;SEE IF WE SHOULD REPEAT
STA SOUNDZP
LDA FRMFRQH,X
STA SOUNDZP+1
LDY #$00
LDA [SOUNDZP],Y
BMI TUNRESTART
JSR ENDTUNE
JMP TUNNEXT
TUNRESTART
LDA TUNINDEX,X ;GET TUNE NUMBER
TAY
LDA TUNLOWFRQL,Y ;GET LOW BYTE OF FREQUENCY LOW ADDRESS
STA LOWFRQL,X
LDA TUNLOWFRQH,Y ;GET LOW BYTE OF FREQUENCY HIGH ADDRESS
STA LOWFRQH,X
LDA TUNFRMFRQL,Y ;GET TUNE DURATION AND FREQUENCY LOW ADDRESS
STA FRMFRQL,X
LDA TUNFRMFRQH,Y ;GET TUNE DURATION AND FREQUENCY HIGH ADDRESS
STA FRMFRQH,X
LDA TUNCTLVOLL,Y ;GET TUNE CNTL AND VOLUME LOW ADDRESS
STA CTLVOLL,X
LDA TUNCTLVOLH,Y ;GET TUNE CNTL AND VOLUME HIGH ADDRESS
STA CTLVOLH,X
LDA #$01 ;SET FREQ, CTL, AND VOL TO BE SET
STA TUNFRM,X
JMP TUNNEXT
; TUNE TABLES, BASE ADDRESSES FOR TUNES AND THE OFFSETS WITHIN THE TUNES WHERE
; THE CTL AND VOL INFORMATION START
TUNLOWFRQL
.byte LOW(LFTUNE00),LOW(LFTUNE01),LOW(LFTUNE02),LOW(LFTUNE03)
.byte LOW(LFTUNE04),LOW(LFTUNE05),LOW(LFTUNE06),LOW(LFTUNE07)
.byte LOW(LFTUNE08),LOW(LFTUNE09);,LOW(LFTUNE0A),LOW(LFTUNE0B)
TUNLOWFRQH
.byte HIGH(LFTUNE00),HIGH(LFTUNE01),HIGH(LFTUNE02),HIGH(LFTUNE03)
.byte HIGH(LFTUNE04),HIGH(LFTUNE05),HIGH(LFTUNE06),HIGH(LFTUNE07)
.byte HIGH(LFTUNE08),HIGH(LFTUNE09);,HIGH(LFTUNE0A),HIGH(LFTUNE0B)
TUNFRMFRQL
.byte LOW(FHTUNE00),LOW(FHTUNE01),LOW(FHTUNE02),LOW(FHTUNE03)
.byte LOW(FHTUNE04),LOW(FHTUNE05),LOW(FHTUNE06),LOW(FHTUNE07)
.byte LOW(FHTUNE08),LOW(FHTUNE09);,LOW(FHTUNE0A),LOW(FHTUNE0B)
TUNFRMFRQH
.byte HIGH(FHTUNE00),HIGH(FHTUNE01),HIGH(FHTUNE02),HIGH(FHTUNE03)
.byte HIGH(FHTUNE04),HIGH(FHTUNE05),HIGH(FHTUNE06),HIGH(FHTUNE07)
.byte HIGH(FHTUNE08),HIGH(FHTUNE09);,HIGH(FHTUNE0A),HIGH(FHTUNE0B)
TUNCTLVOLL
.byte LOW(CVTUNE00),LOW(CVTUNE01),LOW(CVTUNE02),LOW(CVTUNE03)
.byte LOW(CVTUNE04),LOW(CVTUNE05),LOW(CVTUNE06),LOW(CVTUNE07)
.byte LOW(CVTUNE08),LOW(CVTUNE09);,LOW(CVTUNE0A),LOW(CVTUNE0B)
TUNCTLVOLH
.byte HIGH(CVTUNE00),HIGH(CVTUNE01),HIGH(CVTUNE02),HIGH(CVTUNE03)
.byte HIGH(CVTUNE04),HIGH(CVTUNE05),HIGH(CVTUNE06),HIGH(CVTUNE07)
.byte HIGH(CVTUNE08),HIGH(CVTUNE09);,HIGH(CVTUNE0A),HIGH(CVTUNE0B)
; TUNE CHANNEL TABLE - DEFINES WHICH CHANNEL THE TUNE BELONGS IN, INDEXED BY TUNE NUMBER
TUNCHANNL
.byte $00,$01,$03,$03,$00,$01,$01,$00
.byte $00,$00,$00,$00,$00,$00,$00,$00
; TUNE PRIORITTY TABLE - DEFINES WHICH TUNES HAVE PRIORITY OVER OTHERS, INDEXED BY TUNE NUMBER
TUNPRIRTY
.byte $00,$00,$04,$04,$0D,$0D,$08,$04
.byte $04,$0F,$00,$00,$00,$00,$00,$00
; DATA FOR TUNES
; PRIORITY - FOUND IN TABLE ABOVE, INDEXED BY TUNE NUMBER
; CHANNEL - FOUND IN TABLE ABOVE, INDEXED BY TUNE NUMBER
; FREQUENCY LOW BYTE - LOW BYTE OF NOTE (LFTUNEXX)
; FRAME/FREQUENCY - BIT 76543XXX CONTROL THE NUMBER OF FRAMES, BIT XXXXX210 CONTAIN THE HIGH BYTE OF NOTE (FHTUNEXX)
; VOICE/VOLUME - BIT 76--XXXX CONTAIN THE VOICE CONTROL, BIT XX--3210 CONTAIN THE VOLUME (CVTUNEXX)
; $00 IN VOICE/VOLUME ENDS THE SOUND
; TEMPOS
T01 = $00
T02 = $08
T03 = $10
T04 = $18
T05 = $20
T06 = $28
T07 = $30
T08 = $38
LFTUNE02: ; PLAYER SHOT
.byte $05,$04,$03,$02,$01,$00,$00,$00
.byte $00,$00,$00,$00,$00,$00,$00,$00
FHTUNE02: ; PLAYER SHOT
.byte T01,T01,T02,T02,T03,T03,T04,T04
.byte T05,T05,T06,T06,T07,T07,$00,$00
CVTUNE02:
.byte $0D,$0C,$0B,$0A,$09,$08,$07,$06
.byte $05,$04,$03,$02,$01,$00,$00,$00