How to Install the New Sound Driver Alternative by CutterCross

Hey! It’s been a hot minute since I was able to post on this forum. But due to CutterCross’s new sound driver for NES games, I was able to incorporate that into my own NESMaker project.
Now there are Pros and Cons to both GGSound (NESMaker’s default sound driver) and Sabre But because I’m a Quantity guy (in this case for the amount of music) I Highly recommend Implementing
Sabre. But again there are drawbacks to Sabre That GGsound doesn’t have For example, the most obvious one is putting the music tracks into your game manually, And by that I mean the NESMaker Editor for rooms won’t change the song with room settings. You’ll have to program it into that room through code. There is probably more than that but for more Info, I would recommend looking at the Sabre GitHub pages & the ReadMe on there
(trust me my stubborn behind learned that the hard way lol)


Now that that’s outta the way let’s begin!

First things first go into the GameEngineData folder for the Sabre Driver ZIP you just downloaded
Take the sabre.asm and put it into where ggsound.asm lies:
NESMaker\GameEngineData\Routines\BASE_4_5\System
Now open Bank1B.asm (the music bank) under:
NESMAKER\GameEngineData\Routines\BASE_4_5\System\BankData
Replace Line 49: .include "ROOT\System\ggsound.asm"
With: .include "ROOT\System\sabre.asm"
as well as changing these chunks of code:
;;; play sound
LDA sfxToPlay
STA sound_param_byte_0
;LDA sfxPriority
LDA #soundeffect_one
STA sound_param_byte_1
jsr play_sfx
;; play song
LDA songToPlay
sta sound_param_byte_0
jsr play_song
to these:
;;; play sound
LDA sfxToPlay
STA currentSFX
JSR sabre_playSFX
;; play song
LDA songToPlay
STA currentTrack
JSR sabre_playTrack


Now put the sabre_includes.asm into the Sound Folder for NESMaker (again in the GameEngineData Folder for the Sabre download):
NESMAKER\GameEngineData\Sound
Next open Base.asm through NESMaker:
tutorial.png
And replace the line that has
.include "Sound\ggsound.inc”
with:
.include "Sound\sabre_includes.asm”
Next for simplicity’s sake include the file I left for download
And replace Initialization.asm with it.

Next, put sabre_misc_ram.asm & sabre_zp_ram.asm from the sabre unzipped folder and put them in the NESMAKER\GameEngineData\GameData folder

Now open and edit the MemoryMap.asm:
tutorial2.png


Now put these two lines:
.include GameData/sabre_ZP_RAM.asm
.include GameData/sabre_Misc_RAM.asm

In between these two:
.include GameData/ZP_RAM.asm
.include GameData/Variables/UserVariables.asm


So it should look like this to clarify:
index.php

Aight now we should be almost finished!

Now take your (presumably famitracker) songs and export them to a .txt file
Drag that onto sabre’s sabre_ft_txt_asm6.py (assuming you have python installed if not go install the common program 😉)
and if that doesn’t make a .asm file at all…
Just type CMD into your folder bar and put this code in it:
python sabre_ft_txt_asm6.py {filename}.txt {title}
obviously, the filename is the name of your soundtrack file but so should the {title} just without a .txt or .asm obviously
now it should spit out your soundtrack

next put the main file it spat out into your sound folder
Sound\OST.asm
Then replace .include "Sound\AllSongs_WithSFX.asm" in Bank1B.asm with
.include "Sound\OST.asm"

Finally, create two new scripts for the Game part of NESMaker’s Script Settings under the Game Folder
Music Static & Music DPCM
and Define them
I call them SCR_MUSIC_DPCM & SCR_MUSIC_STATIC in the define part of the settings
tutorial4.png
Add them in Base.asm like this…
tutorial5.png
And you're done! Now to change your song
The way you play music is like this:​
PlaySong #$00 ;; the #$00 is the first song in your list keep counting up to have the next track ex: #$01 is after then #$02 then #$03 etc...
And SFX like this:
PlaySound #$00 ;; same logic as PlaySong
Anyway that should be it… If I forgot any installation Steps and you get an error just please send me the error and I’ll determine what the issue is! Happy game designing!​
 

Attachments

  • tutorial3.png
    tutorial3.png
    13.5 KB · Views: 304
  • Initialization_sabre.zip
    1.6 KB · Views: 23

kevin81

Well-known member
Thanks for the tutorial!

I would suggest adding sabre_Misc_RAM.asm outside of zero page RAM though, as they will eat up quite some ZP bytes you might need for other things.
So, basically something like this (in place of line 17-26 of MemoryMap.asm) :

Code:
    .enum $0000
        .include GameData/ZP_RAM.asm
        .include GameData/sabre_ZP_RAM.asm
        .include GameData/Variables/UserVariables.asm
    .ende

    .enum SoundRam
        ;; .include ROOT\System\ggsound_ram.asm <-- comment this out
        .include GameData/sabre_Misc_RAM.asm
    .ende
 
Thanks for the tutorial!

I would suggest adding sabre_Misc_RAM.asm outside of zero page RAM though, as they will eat up quite some ZP bytes you might need for other things.
So, basically something like this (in place of line 17-26 of MemoryMap.asm) :

Code:
    .enum $0000
        .include GameData/ZP_RAM.asm
        .include GameData/sabre_ZP_RAM.asm
        .include GameData/Variables/UserVariables.asm
    .ende

    .enum SoundRam
        ;; .include ROOT\System\ggsound_ram.asm <-- comment this out
        .include GameData/sabre_Misc_RAM.asm
    .ende
Ah gotcha... I'll look into that
 
EDIT THAT I TRIED ADDING TO MY OG POST BUT FAILED:
okay so for the part where I mention that songs only work through code I missunderstood my issue with my importing of my music tracks
if you still import the same tracks the way you ussually do as long as the engine software sees the music tracks in the order they are in through sabre it should play in room settings regardless
the reason for that is due to NESmaker thinking it's assigning the songs through ggsound but sabre fills the void anyway
(if you put the songs in the same order at least... It'll play the tracks coresponding in the same order numerically... so for example I can have a song listed first and a different song in the sabre then the ggsound and it'll play the sabre song always over... but you achieve that through setting in the rooms setting the songs listed there... so yeah I hope I made enough sense... I'm tired af rn
 

Attachments

  • why.png
    why.png
    41.2 KB · Views: 10

vanderblade

Active member
Thanks for posting the walk-through!

I tried my best to get this working while following your steps today but only ended up with a ton of errors at runtime. I'm in no immediate hurry to make the transition, but for the space and cpu efficiencies, I think I will eventually.
 
Thanks for posting the walk-through!

I tried my best to get this working while following your steps today but only ended up with a ton of errors at runtime. I'm in no immediate hurry to make the transition, but for the space and cpu efficiencies, I think I will eventually.
if you want I can implement this into your NESmaker project if you want just DM through this site (or discord if your on the NESmakers discord) your NESmaker Project in a zip file and I'll fix it for you
 

Bucket Mouse

Active member
if you're going to try this, the NMI also needs to be updated. Open NMI.asm, find this:

Code:
    SwitchBank #$1B ;; music bank
     JSR doSoundEngineUpdate
     ReturnBank

And change it to this:

Code:
    SwitchBank #$1B ;; music bank
     JSR sabre_soundUpdate
     ReturnBank

If you don't, you won't hear anything.
 

Bucket Mouse

Active member
One more thing: the variables for GGsound are still in the Zero Page RAM section of your Project Settings. If you don't delete them, they will take up the space of your User Variables, which won't work. So go to Project Settings / Zero Page RAM and get rid of all these:

sound_region
sound_disable_update
sound_local_byte_0
sound_local_byte_1
sound_local_byte_2
sound_local_word_0
sound_local_word_1
sound_local_word_2
sound_param_byte_0
sound_param_byte_1
sound_param_byte_2
sound_param_word_0
sound_param_word_1
sound_param_word_2
sound_param_wrod_3
base_address_instruments
base_address_note_table_lo
base_address_note_table_hi
apu_data_ready
apu_square_1_old
apu_square_2_old
song_list_address
sfx_list_address
song_address
apu_register_sets
 

m8si

Active member
Can't get this to work.

Line 8 on Base.asm has

Code:
 .include "Sound\sabre_includes.asm”


sabre_includes.asm is there but it doesn't seem to find it.

kuva.png
 

m8si

Active member
It probably doesn't matter... But which module did you use? I Started a fresh NESMaker 4.5.9 project with maze module and tried to follow your instructions precisely.
 

m8si

Active member
Whoa. Got it working! =D A super silly mistake as usual, but I'll post it here if it causes trouble for someone else.

In the guide there is a quotation mark that is just different enough to mess things up. xD

quotation.png

Now it is working as intended. It is a great tutorial. Thank you!
 

crazygrouptrio

Active member
I finally got around to setting this up and I got it to work! Thanks for the guide it was very helpful!
I just wanted to add a few more specific tips for anyone who may run into the problems I did:
1. Make sure all instruments have different names. If you have 2 instruments simply labeled "Snare" for example, you will get a "Label already defined" error, because Sabre is creating a label with that same name twice.
2. If using DPCM samples, make sure in Famitracker that they are in order without missing any numbers. (Mine originally was using 1,2, and 4, and got an error that 3 was empty, causing Sabre_ft_txt to not spit out a file.)
3. Take this with a grain of salt, as this problem was inconsistent, but avoid using Instrument 0 in Famitracker. Sabre registered this as "none" and caused errors when trying to compile the rom. Also avoid using the dash "-" in the Triangle and DPCM tracks. This also registered as "none" in a few instances.
4. The Music_Static file DOES NOT have to be in the static bank, and can be put in the music bank pretty easily. I haven't tried putting tracks in different banks just yet so cannot confirm if it affects this, but the static file really fills up the static bank.
 

SciNEStist

Well-known member
For anyone implementing this, Using DCPM samples in your music is awesome, but can have a side effect of causing some controller glitchiness.

To solve this issue, find "doHandleInputReads.ASM" in your Subroutines folder, and replace the entire section thats marked "Do gamepadcheck" to "End gamepadCheck" with the following code:

Code:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; DO GamePadCheck
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

readjoy_safe:
    jsr GamePadCheck
reread:
    lda gamepad
    pha
    jsr GamePadCheck
    pla
    cmp gamepad
    bne reread

readjoy_safe2:
    jsr GamePadCheck2
reread2:
    lda gamepad2
    pha
    jsr GamePadCheck2
    pla
    cmp gamepad2
    bne reread2
    JMP +RID

GamePadCheck:
    LDA #$01
    STA $4016
    LSR
    STA $4016
    LDA #$80
    STA gamepad
ReadControllerBytesLoop:
    LDA $4016
    AND #%00000011
    CMP #%00000001
    ROR gamepad
    BCC ReadControllerBytesLoop
RTS

GamePadCheck2:
    LDA #$01
    STA $4016
    LSR
    STA $4016
    LDA #$80
    STA gamepad2
ReadControllerBytesLoop2:
    LDA $4017
    AND #%00000011
    CMP #%00000001
    ROR gamepad2
    BCC ReadControllerBytesLoop2
RTS

+RID
   
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;END GamePadCheck
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

Save the changes, and now inputs should work fine.
This code was modified from the original doHandleInputReads.ASM using information found here: https://www.nesdev.org/wiki/Controller_reading_code#DPCM_Safety_using_Repeated_Reads

This will stop random phantom button presses from happening when the DPCM channel is used. I can't promise it's the best or most effecient fix, and I would welcome anyone re-writing it to make it better.
 
Last edited:
Top Bottom