Unknown symbol...

Discussion of hardware and software development for Super NES and Super Famicom.

Moderator: Moderators

Forum rules
  • For making cartridges of your Super NES games, see Reproduction.
User avatar
LucianoTheWindowsFan
Posts: 35
Joined: Mon Jun 22, 2020 9:39 am

Re: Unknown symbol...

Post by LucianoTheWindowsFan » Wed Jul 22, 2020 1:38 pm

dougeff wrote:
Mon Jul 20, 2020 9:47 pm
Make sure you mark each SFX with a check in the song list. Also, you need to have unused channels in the song that is playing.
Marked it with a check, didn't play, had unused channels, didn't play.
The SNES is my favorite console, not only because it is an upgrade to the NES, but because it had some quality games as well (e.g. EarthBound and Kirby's Dream Land 3).

User avatar
dougeff
Posts: 2762
Joined: Fri May 08, 2015 7:17 pm
Location: DIGDUG
Contact:

Re: Unknown symbol...

Post by dougeff » Wed Jul 22, 2020 2:41 pm

So, if you have a channel free in the song, it should be on the far right. Channels 7 and 8, for example.

This is the code I used to call the sfx.

AXY8
lda #0 ; sfx # = ding
ldx #127 ; volume 0-127
ldy #6 ;0= the first channel, 6 is the 7th
;for this demo, values 4,5, and 6 work.
;our sound effect uses 2 channels...
;7 will only play 1 channel of the sfx
jsl sfx_play_center

So Y has to be loaded with the channel # (minus 1).

And that number has be be > the highest channel in the song. In this example ldy #6 will play the effect on channel 7 (and 8).

Other than that, I can't think of anything. Without seeing the song file, I can only guess.
nesdoug.com -- blog/tutorial on programming for the NES

User avatar
LucianoTheWindowsFan
Posts: 35
Joined: Mon Jun 22, 2020 9:39 am

Re: Unknown symbol...

Post by LucianoTheWindowsFan » Wed Jul 22, 2020 2:59 pm

dougeff wrote:
Wed Jul 22, 2020 2:41 pm
So, if you have a channel free in the song, it should be on the far right. Channels 7 and 8, for example.

This is the code I used to call the sfx.

AXY8
lda #0 ; sfx # = ding
ldx #127 ; volume 0-127
ldy #6 ;0= the first channel, 6 is the 7th
;for this demo, values 4,5, and 6 work.
;our sound effect uses 2 channels...
;7 will only play 1 channel of the sfx
jsl sfx_play_center

So Y has to be loaded with the channel # (minus 1).

And that number has be be > the highest channel in the song. In this example ldy #6 will play the effect on channel 7 (and 8).

Other than that, I can't think of anything. Without seeing the song file, I can only guess.
Here, I leave the source.
Attachments
The Adventures of the Basset Hound 3.7z
Source code.
(434.96 KiB) Downloaded 49 times
The SNES is my favorite console, not only because it is an upgrade to the NES, but because it had some quality games as well (e.g. EarthBound and Kirby's Dream Land 3).

User avatar
dougeff
Posts: 2762
Joined: Fri May 08, 2015 7:17 pm
Location: DIGDUG
Contact:

Re: Unknown symbol...

Post by dougeff » Thu Jul 23, 2020 5:22 am

I don't see your SNESGSS file (.gsm). But, maybe I don't have to. There are no calls to the sfx functions in your code. (sfx_play_center, sfx_play_left, sfx_play_right, or sfx_play).

For some reason you replaced the one in the example with another call to jsl spc_play_song.

By the way, When you export an SPC file, it gives you a sounds.h file, which tells you the sfx values you need to use..."SFX_DING=0". Use that with one of the sfx functions.

Also, keep in mind. calling spc_play_song actually calls an SPC loader function. This function is very slow and requires 100% of the CPUs attention... which (from what I've read) should be done with interrupts disabled, so generally only done between levels when the screen and everything is turned off (including NMI interrupts, I think).
nesdoug.com -- blog/tutorial on programming for the NES

User avatar
LucianoTheWindowsFan
Posts: 35
Joined: Mon Jun 22, 2020 9:39 am

Re: Unknown symbol...

Post by LucianoTheWindowsFan » Thu Jul 23, 2020 7:40 am

dougeff wrote:
Thu Jul 23, 2020 5:22 am
I don't see your SNESGSS file (.gsm). But, maybe I don't have to. There are no calls to the sfx functions in your code. (sfx_play_center, sfx_play_left, sfx_play_right, or sfx_play).

For some reason you replaced the one in the example with another call to jsl spc_play_song.

When you export an SPC file, it gives you a sounds.h file, which tells you the sfx values you need to use..."SFX_DING=0".

Also, keep in mind. calling spc_play_song actually calls an SPC loader function. This function is very slow and requires 100% of the CPUs attention... which (from what I've read) should be done with interrupts disabled, so generally only done between levels when the screen and everything is turned off (including NMI interrupts, I think).
I changed it before I posted the file, I will just post the gsm.
Attachments
Music.7z
(150.58 KiB) Downloaded 44 times
The SNES is my favorite console, not only because it is an upgrade to the NES, but because it had some quality games as well (e.g. EarthBound and Kirby's Dream Land 3).

User avatar
dougeff
Posts: 2762
Joined: Fri May 08, 2015 7:17 pm
Location: DIGDUG
Contact:

Re: Unknown symbol...

Post by dougeff » Thu Jul 23, 2020 12:21 pm

All of your songs use all 8 channels. SFX will never play with the SNESGSS code. You need empty channels in the song if you want SFX to play at the same time.

If you look at the SPC code (spc700.asm in the Shiru's original files).

Code: Select all

cmdSfxPlay:

	cpy {D_MUSIC_CHNS}		//don't play effects on music channels
	bcs .play

	jsr setReady

	jmp	commandDone

.play:
where y is the channel you are choosing, and my sfx code forces it to be 0-7. You can see that you have to select a channel > the max music channel (D_MUSIC_CHNS).
nesdoug.com -- blog/tutorial on programming for the NES

User avatar
LucianoTheWindowsFan
Posts: 35
Joined: Mon Jun 22, 2020 9:39 am

Re: Unknown symbol...

Post by LucianoTheWindowsFan » Thu Jul 23, 2020 2:21 pm

dougeff wrote:
Thu Jul 23, 2020 12:21 pm
All of your songs use all 8 channels. SFX will never play with the SNESGSS code. You need empty channels in the song if you want SFX to play at the same time.

If you look at the SPC code (spc700.asm in the Shiru's original files).

Code: Select all

cmdSfxPlay:

	cpy {D_MUSIC_CHNS}		//don't play effects on music channels
	bcs .play

	jsr setReady

	jmp	commandDone

.play:
where y is the channel you are choosing, and my sfx code forces it to be 0-7. You can see that you have to select a channel > the max music channel (D_MUSIC_CHNS).
I used the first 2 channels with non-existent instruments, because without these, exporting it as an SPC results in the SPC using the first channels, rather than the last ones, for "Fox Chat", I used the first 6 channels for music (all channels for music that aren't meant to play sound effects) and exporting the music as an SPC, while not exporting SFX as an SPC.
The SNES is my favorite console, not only because it is an upgrade to the NES, but because it had some quality games as well (e.g. EarthBound and Kirby's Dream Land 3).

User avatar
dougeff
Posts: 2762
Joined: Fri May 08, 2015 7:17 pm
Location: DIGDUG
Contact:

Re: Unknown symbol...

Post by dougeff » Thu Jul 23, 2020 2:37 pm

You know, MESEN-S has a very nice SPC debugger. Feel free to check it out. I'm sure you can resolve the issue.

If it was me, I would clear those right 2 channels in the songs.

Edit, upon investigation, the SPC file lists your song as having 8 channels. Thus SFX will never play.
nesdoug.com -- blog/tutorial on programming for the NES

User avatar
LucianoTheWindowsFan
Posts: 35
Joined: Mon Jun 22, 2020 9:39 am

Re: Unknown symbol...

Post by LucianoTheWindowsFan » Thu Jul 23, 2020 3:01 pm

dougeff wrote:
Thu Jul 23, 2020 2:37 pm
You know, MESEN-S has a very nice SPC debugger. Feel free to check it out. I'm sure you can resolve the issue.

If it was me, I would clear those right 2 channels in the songs.

Edit, upon investigation, the SPC code lists you song as having 8 channels.
Earlier, I mentioned that "Fox Chat" will use the first 6 channels for songs that were meant to play with SFXs, however, SFXs will not be exported as SPCs because of that issue, this game was based on this vid by SaveAFox.
The SNES is my favorite console, not only because it is an upgrade to the NES, but because it had some quality games as well (e.g. EarthBound and Kirby's Dream Land 3).

User avatar
LucianoTheWindowsFan
Posts: 35
Joined: Mon Jun 22, 2020 9:39 am

Re: Unknown symbol...

Post by LucianoTheWindowsFan » Thu Jul 30, 2020 9:37 am

dougeff wrote:
Thu Jul 23, 2020 2:37 pm
You know, MESEN-S has a very nice SPC debugger. Feel free to check it out. I'm sure you can resolve the issue.

If it was me, I would clear those right 2 channels in the songs.

Edit, upon investigation, the SPC file lists your song as having 8 channels. Thus SFX will never play.
I made another thing based on your code, the music is in the first 6 channels while the SFX is in the last 2 channels, but it still didn't help.
Attachments
Fox Chat.7z
(1.23 MiB) Downloaded 38 times
The SNES is my favorite console, not only because it is an upgrade to the NES, but because it had some quality games as well (e.g. EarthBound and Kirby's Dream Land 3).

User avatar
dougeff
Posts: 2762
Joined: Fri May 08, 2015 7:17 pm
Location: DIGDUG
Contact:

Re: Unknown symbol...

Post by dougeff » Thu Jul 30, 2020 6:02 pm

It took me a long while to figure it out.

You only loaded half of the SPC file to the SPC RAM. I wish I had made an example / tutorial about this.

Because the SPC can be > $8000 bytes, and we are mapped LoROM, with ROM only from $8000-FFFF, the SPC loader code can't load it all in one move.

I solved this on my own by first loading the SPC file halves to 7f0000-7fffff and then running the SPC loader code. The WRAM is a contiguous $10000 byte space.

edit. Just to be clear. "spc_init" is the SPC loader code.

edit 2. I strongly, strongly, suggest that you change the main instrument #05 Fox3 (present in nearly all songs) to anything else. Just changing them to #06 Strings1 greatly improved them.
nesdoug.com -- blog/tutorial on programming for the NES

Myself086
Posts: 37
Joined: Sat Nov 10, 2018 2:49 pm

Re: Unknown symbol...

Post by Myself086 » Thu Jul 30, 2020 10:14 pm

dougeff wrote:
Thu Jul 30, 2020 6:02 pm
I solved this on my own by first loading the SPC file halves to 7f0000-7fffff and then running the SPC loader code. The WRAM is a contiguous $10000 byte space.
You can load up to 64kb of contiguous ROM when using LoROM. Use a direct or indirect 24-bit pointer (which does cross bank boundary). Let's say that your SPC code starts at $818000, read it at $c18000 and the bank crossing will read a lower mirror of the next bank. The data can't use more than 2 banks.

calima
Posts: 1207
Joined: Tue Oct 06, 2015 10:16 am

Re: Unknown symbol...

Post by calima » Thu Jul 30, 2020 11:53 pm

That sounds like something board-dependent, fullsnes does not mention anything about that hirom area in lorom setups. Aka it may not work depending on your physical board, no?

lidnariq
Posts: 9769
Joined: Sun Apr 13, 2008 11:12 am
Location: Seattle

Re: Unknown symbol...

Post by lidnariq » Fri Jul 31, 2020 12:26 am

Yeah, it's board dependent. LoROM (mode $20) boards without cart RAM allow you to access ROM anywhere /ROMSEL is true, but LoROM boards with cart RAM put nothing (i.e. open bus) in the lower half of banks $40-$6F and $C0-$EF.

The relevant section of FullSNES is this:

Code: Select all

  Board Type               ROM Area               ROM Mirrors
  SHVC-1A0N-01,02,10,20,30 00-7D,80-FF:8000-FFFF  40-7D,C0-FF:0000-7FFF

User avatar
LucianoTheWindowsFan
Posts: 35
Joined: Mon Jun 22, 2020 9:39 am

Re: Unknown symbol...

Post by LucianoTheWindowsFan » Wed Oct 14, 2020 12:58 pm

dougeff wrote:
Thu Jul 30, 2020 6:02 pm
It took me a long while to figure it out.

You only loaded half of the SPC file to the SPC RAM. I wish I had made an example / tutorial about this.

Because the SPC can be > $8000 bytes, and we are mapped LoROM, with ROM only from $8000-FFFF, the SPC loader code can't load it all in one move.

I solved this on my own by first loading the SPC file halves to 7f0000-7fffff and then running the SPC loader code. The WRAM is a contiguous $10000 byte space.

edit. Just to be clear. "spc_init" is the SPC loader code.

edit 2. I strongly, strongly, suggest that you change the main instrument #05 Fox3 (present in nearly all songs) to anything else. Just changing them to #06 Strings1 greatly improved them.
Tried to fix it and it worked!
Attachments
SNES_10.sfc
(512 KiB) Downloaded 8 times
The SNES is my favorite console, not only because it is an upgrade to the NES, but because it had some quality games as well (e.g. EarthBound and Kirby's Dream Land 3).

Post Reply