News: 11 March 2016 - Forum Rules
Current Moderators - DarkSol, KingMike, MathOnNapkins, Azkadellia, Danke

Author Topic: FF1 MMC5 Disassembly Updates  (Read 76190 times)

Vanya

  • Hero Member
  • *****
  • Posts: 1489
    • View Profile
Re: FF1 MMC5 Disassembly Updates
« Reply #260 on: May 06, 2019, 04:41:45 am »
Hmmm... I'm not sure how I feel about that new track.
I'm a little weary of battle themes that are arrangements of existing tracks.
So I might be a bit harsh in my criticism because of that.

I hear what you mean about the baseline.
There is something a bit off sounding about it, for sure.

As someone that can't do music in much any way that's worth diddly squat, I find it an amazing feat.
That said, a remix of the Temple of Chaos is a a cool idea for the Fiend battle music, BUT that first half of the melody just sounds way too upbeat for battle music (or even as dungeon music).

I basically have the same problem with the Temple of Chaos and Underwater Shrine themes. They start off sounding way too upbeat for places that are full of dangerous monsters lead by a Fiend of Chaos.
That's why I suggested doing something different for the Underwater Shrine before. With this battle theme in the game, I want that Underwater Shrine theme replaced even more.

The second half of the melody is awesome and I love how you got it to convey a definite feeling of urgency.

Right now this is what I would do with these songs:
Code: [Select]
Location                -> Song
------------------------------------------------------------------------------------------
Temple of Chaos (Ruins) -> Undersea Shrine
Temple of Chaos (Past)  -> Temple of Chaos
All Fiend battles       -> Your new battle theme.
Garland battle          -> Maybe this one could use your Fiend theme too as foreshadowing.
Sunken Shrine           -> My hypothetical remix/extension of the Deep Place fanfare
                           (that-I-have-no-hope-of-ever-being-able-to-make-on-my-own).



Could I ask a favor?
When you get a chance, could you modify the old marsh cave song to include a version the battle intro notes using old marsh cave's baseline?
I'd love to hear it in the form of a proper battle theme.
« Last Edit: May 06, 2019, 04:48:58 am by Vanya »

Jiggers

  • Sr. Member
  • ****
  • Posts: 254
    • View Profile
Re: FF1 MMC5 Disassembly Updates
« Reply #261 on: May 06, 2019, 04:30:53 pm »
This really shouldn't be an issue.  Multiplication gives you a two byte product, right?

Untested pseudo-code:
Code: [Select]
LDA song_id
LDX #10
JSR MultiplyXA
CLC
ADC #<song_pointer_table
STA tmp
TXA
ADC #>song_pointer_table
STA tmp+1

LDY #0
@Loop:
  LDA (tmp),Y
  ; ... read the channel pointers from (tmp), using Y as index

I only brought it up because at first I thought that's why the music wasn't playing in battle. It turns out I just was counting the tracks as starting at $41 instead of $40, so I was trying to play music that didn't exist. I suppose I should make sure adding new songs works eventually though, so I'll stick this in there as a note!

Holy moly I'm loving the fiend battle track!
Nice work!

:D Thanks!

As someone that can't do music in much any way that's worth diddly squat, I find it an amazing feat.
That said, a remix of the Temple of Chaos is a a cool idea for the Fiend battle music, BUT that first half of the melody just sounds way too upbeat for battle music (or even as dungeon music).

I basically have the same problem with the Temple of Chaos and Underwater Shrine themes. They start off sounding way too upbeat for places that are full of dangerous monsters lead by a Fiend of Chaos.
That's why I suggested doing something different for the Underwater Shrine before. With this battle theme in the game, I want that Underwater Shrine theme replaced even more.

Funny, my girlfriend said the same thing. Said the Temple of Fiends was more like Frolicking in Flowers to her. Yet both those songs are my favourites in the whole game because they feel melancholy to me!

So I made some changes... the second half of the Temple of Fiends melody is now more... off. Some chord changes and pushing the melody down a bit more here and there. The bass now matches the square 3 drones, and I raised/lowered it in places to keep it within the second-lowest octave. Its lowered more during the second half of the Sea Shrine melody at the end, and raised more during the Temple of Fiends part. Changed a few frills around at the start and end of the song, and tweaked the harmonic melody played by square 4, then raised the trills much higher.

Update: Since I can't leave well enough alone, I did more changes, mostly for the clarity of the music. Less notes overlap and such, and the volcano bass line just before the loop point is boosted by a square that was just playing a droning note before.

And here's something fun to look at, just 'cos.

https://cdn.discordapp.com/attachments/535538496547586060/575098568852111363/FiendBattle.png

Could I ask a favor?
When you get a chance, could you modify the old marsh cave song to include a version the battle intro notes using old marsh cave's baseline?
I'd love to hear it in the form of a proper battle theme.

Actually, I found out that I could possibly just make the battle intro woosh thing its own song, have it play at the start, then when it ends, the battle music code is set up to play a second song. I wonder if that was the intention behind that, and they just never got around to it?
« Last Edit: May 06, 2019, 07:16:47 pm by Jiggers »
I know exactly what I'm doing. I just don't know what effect it's going to have.

Vanya

  • Hero Member
  • *****
  • Posts: 1489
    • View Profile
Re: FF1 MMC5 Disassembly Updates
« Reply #262 on: May 06, 2019, 10:57:24 pm »
Wicked. Definitely going in the right direction. :)
Some of the notes in the beginning after the battle intro sound a bit dissonant, but otherwise it's progressing really well.

You might be right about the battle intro.
Makes sense to me at least.

PS- My girlfriend (who actually does know about music) thinks your new Marsh Cave song is really good and would work well in a Castlevania game.
« Last Edit: May 06, 2019, 11:15:22 pm by Vanya »

daman.tm

  • Jr. Member
  • **
  • Posts: 11
    • View Profile
Re: FF1 MMC5 Disassembly Updates
« Reply #263 on: May 07, 2019, 06:04:07 am »
On the topic of music, one of the major gripes I had with FF1 is how a song restarts when you go up/down stairs. Would it be possible to continue playing a song instead of making it restart? So many good songs in FF1, but you keep hearing the first few couple of seconds, never enough to truly appreciate the music

Vanya

  • Hero Member
  • *****
  • Posts: 1489
    • View Profile
Re: FF1 MMC5 Disassembly Updates
« Reply #264 on: May 07, 2019, 05:57:27 pm »
That's a good point.
I second that.



So the current build I tried out last night; there is a bunch of bugginess in the battle system.
Enemies running away out of nowhere, enemies that are not in the formation being named in the messages, that sort of thing.
« Last Edit: May 07, 2019, 06:03:59 pm by Vanya »

Mari42

  • Jr. Member
  • **
  • Posts: 84
    • View Profile
Re: FF1 MMC5 Disassembly Updates
« Reply #265 on: May 07, 2019, 08:25:01 pm »
On the topic of music, one of the major gripes I had with FF1 is how a song restarts when you go up/down stairs. Would it be possible to continue playing a song instead of making it restart? So many good songs in FF1, but you keep hearing the first few couple of seconds, never enough to truly appreciate the music

Like the future FF1, yea. It is possible.

Jiggers

  • Sr. Member
  • ****
  • Posts: 254
    • View Profile
Re: FF1 MMC5 Disassembly Updates
« Reply #266 on: May 07, 2019, 09:14:39 pm »
Fixed the enemy stats! I made a whoopsie while changing things and now its all better. If there are any more problems in battle, its gotta be something else loading stats wrong. But there's no reason they should be!

I'm looking into having music not reset on changing floors... I won't attempt to make music restart from its previous position after a battle, though. Not unless there's some way to consolidate all the music RAM into one place. Right now there's some in zero page, some in save RAM. (Hey, does zero page get swapped with the rest when RAM swaps with the MMC5? ...it does not.)

The stack annoys me. I notice it goes deeper just by moving floors back and forth in the first castle. Should it be doing that? Shouldn't it be going backwards once you go back to a previous floor? It doesn't seem to break the game if I overflow it... All I did was go back and forth on the stairs then leave, though.

Something for people to test: If you have the ship or airship, get on it to have the music change, then dock/land to change the music back to the main overworld theme. Save the game in the menu; what song plays after? For me, its the ship theme! Aaaand, soon as I post this, that stops happening.

Also, how many scanlines does the NES use? Need to set Square2 SFX for a certain amount of frames... Its the opening/closing screen that's shutting music off between floors, and it was using Square 1 for some reason and shutting the rest off. So I got it using square 2, and not shutting the rest off. Will see how weird things sound, but not sure how to do the math to count how many frames it takes before square 2 is allowed to play normal music again. Edit again: Sorta figured it out to 22 frames.



So I'm not sure how to do this cleanly. During the screen-wipe phase, there's a bunch of loading routines going on, and they don't call music playing or do any kind of frame counting, because they don't have to. They're just decompressing maps and stuff while the screen is off. So one option is to put in some VBlank waits and have music playing--but I don't know where to put them.

Second option: Turn off music in a way that lets it resume normally when the screen wipe is done. Issue with this is not every instrument turns back on. Say the triangle and main melody are both playing long notes, while there's some quick doot-doot-dooting going on, like practically every song in the game. The doot-doots will be heard for a second before the triangle or anything else plays the next note.

What I'm going to try next is to turn off music, but also poke at the things that tell the music what to do, to let them know to change the volume back up immediately...? Somehow?

Update: It worked! Kinda! The squares hate it! They squeak when being shut off, then sometimes squeal when being turned on again...

« Last Edit: May 07, 2019, 11:25:37 pm by Jiggers »
I know exactly what I'm doing. I just don't know what effect it's going to have.

Disch

  • Hero Member
  • *****
  • Posts: 2723
  • NES Junkie
    • View Profile
Re: FF1 MMC5 Disassembly Updates
« Reply #267 on: May 07, 2019, 11:16:03 pm »
I'm looking into having music not reset on changing floors...

Easiest way I can think of to do this is to keep track of what song is currently playing, and then when a new song is played, compare it to the "current" one and do nothing if they match.

The music doesn't actually need to stop for the stair transition -- MusicPlay just needs to not be called.  Once you start calling MusicPlay again, it'll naturally resume from where it left off assuming RAM hasn't been clobbered.

Quote
I won't attempt to make music restart from its previous position after a battle, though.

That would be a bit harder, but not much.  You'd just have to snapshot all of music ram somewhere and then restore it afterwards.  But I think you already have that idea  ;)

Quote
The stack annoys me. I notice it goes deeper just by moving floors back and forth in the first castle. Should it be doing that? Shouldn't it be going backwards once you go back to a previous floor?

2F of Coneria castle can't use a 'warp' staircase to go back because you can teleport into it by talking to the princess in ToF.  If it had a warp staircase, going down the stairs would warp you back to ToF!  So it has to have a two-directional staircase there.

That's a rare exception to the rule.  The only other place that can't use warps is the Ice Cave (because of the pits creating a circular path).

Quote
It doesn't seem to break the game if I overflow it... All I did was go back and forth on the stairs then leave, though.

It can, and often does.  In fact some speedrunners exploit that glitch for any% speedruns.


Quote
Also, how many scanlines does the NES use?

The full frame is 262 scanlines:
20 scanlines of VBlank
1 "pre-render" scanline
240 rendered scanlines
1 "idle" scanline

Quote
Need to set Square2 SFX for a certain amount of frames...

You probably don't need to do that for this effect.  The Sq2 sfx trigger only prevents sq2 from interrupting the music -- if you just simply don't call MusicPlay during the transition effect, there's nothing to interrupt.

Quote
Say the triangle and main melody are both playing long notes, while there's some quick doot-doot-dooting going on, like practically every song in the game. The doot-doots will be heard for a second before the triangle or anything else plays the next note.

You should be able to deduce what tone/volume the channels SHOULD be playing at any given time by their data in RAM.  If you do my above idea of comparing new song to current song -- maybe use that opportunity to restart notes:

1) MusicPlay normally just plays music
2) Unless a new song is requested
3) If a new song requested, see if it's the same as the current song
3a)   If same, use data in RAM to "restart" all channels and resume song without restarting
3b)   If not same, load a new song and start it from the beginning as normal

Vanya

  • Hero Member
  • *****
  • Posts: 1489
    • View Profile
Re: FF1 MMC5 Disassembly Updates
« Reply #268 on: May 08, 2019, 02:19:03 am »
Actually, I found out that I could possibly just make the battle intro woosh thing its own song, have it play at the start, then when it ends, the battle music code is set up to play a second song. I wonder if that was the intention behind that, and they just never got around to it?

Hmmm... then I guess if that could be done I would still want a version of the battle intro jingle that uses the Old Marsh Cave baseline instead of the normal one.
I might be able to do that myself.
Any tips for how to accomplish this?

Jiggers

  • Sr. Member
  • ****
  • Posts: 254
    • View Profile
Re: FF1 MMC5 Disassembly Updates
« Reply #269 on: May 09, 2019, 01:52:08 pm »
2F of Coneria castle can't use a 'warp' staircase to go back because you can teleport into it by talking to the princess in ToF.  If it had a warp staircase, going down the stairs would warp you back to ToF!  So it has to have a two-directional staircase there.

That's a rare exception to the rule.  The only other place that can't use warps is the Ice Cave (because of the pits creating a circular path).

Figures I'd test it with the one place that its wonky. But using warp magic in the Ice Cave would still set you back to the previous teleport, right?

Thanks for all the answers to everything else! I did already figure out how to keep music going, the issue was silencing things while MusicPlay isn't being called. Using #$30 to set the volume for the squares worked though! Just putting a 0 was making weird noises when it stopped and started. So I was setting the bit in each track to make MusicPlay re-set the duty and everything else when it re-started and that wasn't necessary after all. Or maybe doing that would make things smoother, but as it is now, I think it sounds good enough!

Having learned that $0300 is not swapped with RAM, I have some more re-arranging to do. Gonna use that space for extra music stuff. Right now its mostly shop/battle message things, so... look forward to all that getting screwed up again!

Hmmm... then I guess if that could be done I would still want a version of the battle intro jingle that uses the Old Marsh Cave baseline instead of the normal one.
I might be able to do that myself.
Any tips for how to accomplish this?

Sorry, I just kinda did it! Marsh Cave bassline plays $0x (C note) notes to start, 5 tones above the usual battle intro bassline. So I set the octave higher, copied those notes and the pauses over, then set the octave lower for the two-note dip ($Ax, or Bb), loop it once, then use the "no questions asked" loop code to  play the original Marsh Cave music after.

It took some thinking, but it seems like I got it set so we can add a lot more music tracks, too? So that's nice.

The Marsh Cave battle music is listed as "Fiend Battle 2" in the sound test menu. For now.



Important update!

Before using the new variables.inc file, make sure your magic inventory is empty! Otherwise you will lose spells! (You may also somehow gain spells after...)

Now that I understand things better, I'm trying to have music also restore itself after battles. It mostly works, but so far only after the second battle after switching between ship/on land music. I just pushed a tiny fix for that that I hope will work, so maybe not.

Sometimes the music squeaks when restoring. I might try muting things for a frame before it restarts. (Update on that: It waits 2 frames now, so let me know if you hear wrong notes after battles!)

Otherwise, I've noticed a crunchy sort of sound when getting on the ship. It might just have been the wave SFX starting quiet, dropping to 0 before starting up again?

And there it is again, on land music starting up after saving on the ship! Grr. But then, maybe the tiny fix I just pushed fixes that too! Since it makes sure to save the ship/on land music as the backup song once it switches.

BAH NOW THE FANFARE JUST KEEPS PLAYING ON THE OVERWORLD! WHY!!

I had the walking to the left animation be a JMP instead of a JRS and somehow that wasn't breaking things so I didn't notice the mistake until now. Pbbblt. Just to find out now if you walk to the left after beating Chaos or what...
« Last Edit: May 09, 2019, 06:32:40 pm by Jiggers »
I know exactly what I'm doing. I just don't know what effect it's going to have.

Vanya

  • Hero Member
  • *****
  • Posts: 1489
    • View Profile
Re: FF1 MMC5 Disassembly Updates
« Reply #270 on: May 09, 2019, 07:25:41 pm »
No apology need, bud.
As much as like missing with this stuff, I always appreciate not having to do something myself.
Bah! Music is really not my thing anyway.
Thanks again!



OMG! I love it!
Now I need to hear it in action.

And thank you from the bottom of my soul for turning off that stupid "there's nothing in front of you" message!!



Groovy! That Marsh Battle theme sounds awesome in action.
I have a concern tho.

You might have thought of this already, we need a way to be able to set different battle music besides the BattleMusic_LUT.
It could be expanded, but I guess there would have to be a new battle configuration layout.
Like a copy of the Fiend battle configuration so there could be a second Fiend battle song.

(Or for my purposes...)
Adding copies of the 9 small and 4 large battle configurations so I could have the Marsh Battle song be used for normal bosses like Garland, the Bikkeneers, or Astos.

Actually, as long as more battle configurations could be made, it might be a good idea to actually have slightly modified configurations to a small or large sized boss could be centered on the enemy side of the screen.

Does that sound feasible?
« Last Edit: May 09, 2019, 08:54:45 pm by Vanya »

Jiggers

  • Sr. Member
  • ****
  • Posts: 254
    • View Profile
Re: FF1 MMC5 Disassembly Updates
« Reply #271 on: May 09, 2019, 10:41:29 pm »
Actually, as long as more battle configurations could be made, it might be a good idea to actually have slightly modified configurations to a small or large sized boss could be centered on the enemy side of the screen.

Does that sound feasible?

Iii have no idea. With regards to enemy placement on the screen, that is. The rest... yeah, I think so. Halfway through doing it already. Gotta find out which set of lut_BattleFormations is which battle next, then set the high bits of the first byte to 5 or 6. 5 for Garland and Astos and... Vampire? (Is that its own entry or does the game do something else to make sure you only face one...) 6 for Pirates. And uh... I'll put in 7 for the Eye and Zombie Dragon(s?) if they use the 4 big enemy layout.

I've also done something experimental with battle messages. Yeah, they're half as fast now, but please let me know if that's gotten rid of the weird laggy battle music!

Instead of printing $20 tiles per row before updating audio, its $10, then the next $10. And instead of two rows before updating audio, while undrawing the boxes, its 1 row, then update. I think. I feel like it made a difference, but again--my ears aren't so good catching it and my computer's own random stuttering means I might never catch it. I only noticed when Disch first pointed it out!

If that DID get rid of the issue, then I might need some help re-writing those bits to be faster...

Still not even sure if that can actually be the problem, though. Like, if the writing is taking so long that the music hangs an extra frame, wouldn't that mean its drawing outside of VBlank again...? There would be screen artefacts and stuff, right?
I know exactly what I'm doing. I just don't know what effect it's going to have.

Disch

  • Hero Member
  • *****
  • Posts: 2723
  • NES Junkie
    • View Profile
Re: FF1 MMC5 Disassembly Updates
« Reply #272 on: May 09, 2019, 11:00:52 pm »
I definitely still hear the music stuttering.   :-\  Though it does seem less noticeable than before.

Seems most noticeable when the very bottom text bar is undrawn (the wide one with the "terminated" message).

I'll take another stab at it this weekend to see if I can figure out what's happening.

Jiggers

  • Sr. Member
  • ****
  • Posts: 254
    • View Profile
Re: FF1 MMC5 Disassembly Updates
« Reply #273 on: May 09, 2019, 11:48:55 pm »
That's what I thought, too... but then today my brain was telling me it was the # hits box. I think I can definitely hear it when there's more than one long message box, too. Especially with Critical Hit > Stole Gold > Terminated.

I got mini boss music working right! I set it up for Garland, Vampire, Astos, the Eye, and the Pirates. I've only tested it on Garland, though. Also reminded just how much I loathe the original Marsh Cave music... Forcing myself not to write an addition so it doesn't loop so soon...

I'll see if the zombie dragon battle occurs normally anywhere before setting it for that one. Not gonna set it for wizards guarding the crown because they're a normal random battle later too.
I know exactly what I'm doing. I just don't know what effect it's going to have.

Mari42

  • Jr. Member
  • **
  • Posts: 84
    • View Profile
Re: FF1 MMC5 Disassembly Updates
« Reply #274 on: May 10, 2019, 12:07:32 am »
I noticed that there was a tile appearing in the bottom right corner when entering battle, and the game lags very bad in battle as well. Is it just me? Its not my computer that lags instantly.  :-\

Jiggers

  • Sr. Member
  • ****
  • Posts: 254
    • View Profile
Re: FF1 MMC5 Disassembly Updates
« Reply #275 on: May 10, 2019, 12:21:49 am »
Oh, yeah. Since it didn't fix the battle music being laggy, I undid the half-speed battle messages. Not sure about the tile though. Overworld or dungeon battle? What kind of tile was it?

Also, sorry for telling you I couldn't/wouldn't have dungeon music keep its place after battle! I just had to learn a few more things before it was easy enough to try!
I know exactly what I'm doing. I just don't know what effect it's going to have.

Vanya

  • Hero Member
  • *****
  • Posts: 1489
    • View Profile
Re: FF1 MMC5 Disassembly Updates
« Reply #276 on: May 10, 2019, 12:27:33 am »
Also reminded just how much I loathe the original Marsh Cave music... Forcing myself not to write an addition so it doesn't loop so soon...

Go for it. As long as you keep the style consistent I'm sure it'll be fine.
It is a short loop so extending it out a bit would be good.

Mari42

  • Jr. Member
  • **
  • Posts: 84
    • View Profile
Re: FF1 MMC5 Disassembly Updates
« Reply #277 on: May 10, 2019, 12:35:32 am »
Oh, yeah. Since it didn't fix the battle music being laggy, I undid the half-speed battle messages. Not sure about the tile though. Overworld or dungeon battle? What kind of tile was it?

Also, sorry for telling you I couldn't/wouldn't have dungeon music keep its place after battle! I just had to learn a few more things before it was easy enough to try!

maybe the menu tiles...  :-\



tiles appeared right-bottom side.

Disch

  • Hero Member
  • *****
  • Posts: 2723
  • NES Junkie
    • View Profile
Re: FF1 MMC5 Disassembly Updates
« Reply #278 on: May 10, 2019, 12:42:48 am »
Yikes.  That looks like that might be some drawing code spilling outside of VBlank.  Which might also explain the lag if it's missing a frame somehow.

I didn't see anything like that when I ran in FCEUX... which also suggests it's timing related since different emus are behaving different.

What emu are you using, Mari42?

Mari42

  • Jr. Member
  • **
  • Posts: 84
    • View Profile
Re: FF1 MMC5 Disassembly Updates
« Reply #279 on: May 10, 2019, 12:45:24 am »
Yikes.  That looks like that might be some drawing code spilling outside of VBlank.  Which might also explain the lag if it's missing a frame somehow.

I didn't see anything like that when I ran in FCEUX... which also suggests it's timing related since different emus are behaving different.

What emu are you using, Mari42?

FCEUX 2.2.2