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

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

Jiggers

  • Sr. Member
  • ****
  • Posts: 308
    • View Profile
    • My Ko-Fi Page
Re: FF1 MMC5 Disassembly Updates
« Reply #460 on: December 19, 2019, 02:18:00 am »
I have a request! Could you add in a 3rd set of separator tiles that is centered vertically?
Or I could do it myself, but I think it might be generally useful for all users to have those available out-of-the-box.

Second thing. How can update my branch n the github to match your current version?

Box connectors updated! Orbs graphics were shifted about a bit to make it all neat and orderly. Also got rid of the in battle tiles for the menu stuff, but added in a dark-background bomb to make the delete-your-save? message more... explosive. Funny you said out of the box, but the connectors are for staying inside boxes...

The GitHub stuff, I dunno. I can throw around the buzzwords "clone the repro" but if that's the answer its a lucky guess and as for how, no idea. I don't like working with it, I couldn't even figure out how to make a clone of the main thing so I could do updates without ruining the stability for everyone else. Sorry!

Update: Saw your edit and fixed it a few hours ago! Another casualty of the zero-page RAM shuffle. Trying to keep everything separate enough where I can so it all makes more sense, but I guess those 2 exp pointers overlapped originally for a reason, and I didn't understand why.
« Last Edit: December 19, 2019, 10:28:30 pm by Jiggers »
I know exactly what I'm doing. I just don't know what effect it's going to have.

I wrote some NES music! Its a legal ROM file. - I got a Ko-Fi page too.

Vanya

  • Hero Member
  • *****
  • Posts: 1562
    • View Profile
Re: FF1 MMC5 Disassembly Updates
« Reply #461 on: December 20, 2019, 12:04:44 am »
Groovy. Thanks. I'm going to look up some more info on Github and see if I can get a better handle on it.

About the ruined castle song.
Can you make a version of it that replaces the melody from the original castle song with something new?
I'd like them to be completely separate tunes so that we can have a creepy sounding theme that isn't so tied to a castle specifically.

Actually on the subject of music...
How do you feel about possibly composing or arranging a few more songs?
And is there space to add 4 to 5 more?

You see, one of the things I never liked was the reuse of too many themes.
I'd really like each major dungeon to have their own theme.

Actually, how do I make the shops act like the menu does in regards to music?
You know, so that it continues to play the music that was already playing when you entered?

If I remember correctly there is an lut with in one of the banks that controls which map plays what song, no?



Oh-oh! Something in the character creation screen is screwed up.
When I press B to go back to player 3 after I added a name, the cursor is in the wrong spot and then all kinds of bad things happen to the graphics when I try to change a letter.

I'm seeing the text flickering happening multiple times in-between the menu boxes updating.
Makes me think that there is a point at which it is reloading the text graphics outside of vblank maybe?
I don't really understand vblank much anyway, tho.

I had the game soft-lock after a battle after fading to black.
« Last Edit: December 20, 2019, 12:48:48 am by Vanya »

Jiggers

  • Sr. Member
  • ****
  • Posts: 308
    • View Profile
    • My Ko-Fi Page
Re: FF1 MMC5 Disassembly Updates
« Reply #462 on: December 20, 2019, 12:40:08 am »
I could probably whip up a new melody for the ruined castle theme...

But, unless someone's going to pay me, I probably won't do any more new songs for it. The job I'm supposed to be doing already is writing a bunch of songs for a game! So that employer has dibs on my musical ideas until they settle on the songs they want, then I can scavenge the ideas they didn't like. Unless they outright reject something, then I can work on it in my spare time--but there's so much else that needs to be done.  :(

My new Marsh Cave song is actually going to be for someone else's game as well, but they're letting me keep it in this project.

Space-wise, the rest of the 0s in Bank 0D is what's left. So, yeah, probably a lot of songs. (I believe its 3,923 bytes left.) (Though the rest of the score data is 10,274 already, so maybe like 10 songs?) (But most of them don't make use of my new loop code, so that may or may not help squeeze new songs in.)

Bank 1F has lut_MapMusicTrack, so you can set any song to any map now.

To turn off shop music, look for EnterShop in Bank 0E and remove the $4015 and $5015 writes that silence audio, then remove the music_track and dlgmusic_backup writes where it jumps to Shop/Inns/Clinics. Fairly sure that will do it. If you want shop music to be muted like the menu, then put in "INC MenuHush" where the $4015 write is. If not, then you'll want to do that after both "JSR EnterShop"s in Bank 1F. If this variable is 0 when it gets to doing music for the next map frame, then exiting the shop will reset the map music.



Worked out some new melodies for the ruined castle song:

https://drive.google.com/open?id=1Cm6LJR3piCZwhyKAwzMu_gak7MP1NJjx

https://drive.google.com/open?id=1VONXxcjRj4sHeuz1kbXpGsyX6zDxshPh

I'm partial to #2 myself (title, not link, no idea which link is which.) Whatcha think?
« Last Edit: December 20, 2019, 01:46:24 am by Jiggers »
I know exactly what I'm doing. I just don't know what effect it's going to have.

I wrote some NES music! Its a legal ROM file. - I got a Ko-Fi page too.

Vanya

  • Hero Member
  • *****
  • Posts: 1562
    • View Profile
Re: FF1 MMC5 Disassembly Updates
« Reply #463 on: December 20, 2019, 02:01:28 am »
1) [New Melody] Thank you!! :3
#2 is definitely more in the direction I was thinking.
Something more muted that blends in with the creepy overtones.

2) [Music Job] That's awesome! Depending how things go, I may need your professional talents at some point. :D

3) Thanks again for all your help with my random tweaking. :3



Bugs...

Went into the magic menu to try to cast Cure.
Only happened once, but pointer started at the top of the screen.
Pressing down corrected the pointer position with no other issues.

Noticed that after I ran from a battle while the chicken Knife was equipped, it did not update the Damage value in the character's Status screen. Value updated after I removed and re-equipped it.
« Last Edit: December 20, 2019, 04:35:27 am by Vanya »

Jiggers

  • Sr. Member
  • ****
  • Posts: 308
    • View Profile
    • My Ko-Fi Page
Re: FF1 MMC5 Disassembly Updates
« Reply #464 on: December 20, 2019, 05:12:42 am »
I'll work on getting that #2 melody in there as an option soonish, then! And thanks as well!

Good catch on the Chicken Knife... A quick unequip-reequip call will sort that after battle, or when entering the menu (I assume it'd show wrong info on the equip screen as well, at first.)

Weird about the Cure thing. I had a battle where after getting to where it should start to fade out, they stopped, the black mage cast Fire a second time, then it froze. Wasn't able to re-produce it.

Before you even asked about music, today I was working on stripping out everything but the music driver and the bare basics to draw stuff on screen. Kind of a sound-test only fork.

https://drive.google.com/open?id=1sRYMP14111ducsUYVxZXwxBy9fbMuqeh

I figure I only need two banks, so I cut it down to $0F banks again and filled the insides with blanks. So just $00 and $0F have stuff in them. But I can't compile it--before I had an error where the fixed bank was overflowing by 13,000 or so bytes. I deleted the music driver I had put in there, and its still over 1,000 which is STUPID because I ripped WAY more than that out. I can't spot the error with nes.cfg and I still don't understand the build.bat stuff enough to know if its something in there screwing it up. Or even the nes header. So if anyone can help me sort that out, that would be really really great! And if there's a way to strip the rom down to only 2 banks and make it really teensy in size, I'd like to know too. I kind of just assumed it had to be at least 256k... heck maybe if I put it back to 516k it'll compile... I'll find out tomorrow!

Edit: No more trying to do things at 5 AM for me... figured it out in minutes after waking up.  :P
« Last Edit: December 20, 2019, 04:08:41 pm by Jiggers »
I know exactly what I'm doing. I just don't know what effect it's going to have.

I wrote some NES music! Its a legal ROM file. - I got a Ko-Fi page too.

Vanya

  • Hero Member
  • *****
  • Posts: 1562
    • View Profile
Re: FF1 MMC5 Disassembly Updates
« Reply #465 on: December 22, 2019, 12:41:52 am »
Oh, yeah. That happens to me all the time.
I'll wrassle with a bit of code that won't cooperate all night, go to sleep, then see my logic error with in minutes or even seconds the next morning. *Awesome*!

Jiggers

  • Sr. Member
  • ****
  • Posts: 308
    • View Profile
    • My Ko-Fi Page
Re: FF1 MMC5 Disassembly Updates
« Reply #466 on: January 05, 2020, 01:10:09 am »
Actually felt like tackling this screen problem again...

My rough idea is: Every box is drawn to RAM fully, starting at $7500. There is enough room for several more box types even after all the main things. The boxes are drawn empty, but the tiles for the borders are there. This is done! I've done this.

The rest I'm spitballing right now.

Next, in all messages, the box ID is given first. This then tells the game where to decompress the messages. So you get a message box ID, then a message ID, say... $4A = "Ineffective now". That is then immediately drawn to $79A2, which is the middle row of the message box (top row starts at $79A0, #33 bytes long, then #1 byte for the left side of the box.) It never has to be decompressed again.

The order of the boxes are stored in a short buffer, say 8 bytes long (8 boxes is a lot!)

The game draws the boxes in order, more or less the same way it draws the boxes now...? There is a buffer in RAM that holds the tiles, how they would be displayed on the screen. Boxes overlayed over each other and so on.

Undrawing... this is the tricky part... For every row that's undrawn, it has to re-build the screen from scratch, right? That's what the game does now? So the same thing, but instead of having to decompress every battle message and go through the control codes over and over and over, swapping banks in and out to fetch names of weapons and monsters and so on... it just reads the box ID from the short buffer, uses that to check the LUT that tells it where in RAM that box and its contents are. Copies that onto the screen buffer. Uses the tiles to know when to jump ahead or finish up a box: $79, $FB, $FE.

And that... should be a lot faster, shouldn't it? Maybe? Maybe not...?

It seems to take 1 and a half frames to just fill up RAM with the empty boxes...

Alternatively... I keep helping de-assemble FF2 and just try to steal whatever they're doing with their battle boxes because those things are way too fast. Its using a sprite-0 hit thing and calling the check on that a lot from the part of the game I was digging into--not sure how often, but at times that didn't seem like it should need to bother. So that could be another solution somehow, just slip a bunch of JSR checks to make sure that the bottom of the screen uses sprites??

FF2's thing:
Code: [Select]
L3FD46:
    BIT PpuStatus_2002       ; FD46  $2C $02 $20
    BVS L3FD46               ; FD49  $70 $FB
L3FD4B:
    LDA $3B                  ; FD4B  $A5 $3B
    STA PpuControl_2000      ; FD4D  $8D $00 $20
    LDA $39                  ; FD50  $A5 $39
    STA PpuScroll_2005       ; FD52  $8D $05 $20
    LDA $37                  ; FD55  $A5 $37
    STA PpuScroll_2005       ; FD57  $8D $05 $20
    RTS                      ; FD5A  $60

Then in Bank 05, which is so far mainly just for calculating stat level ups, this is called 18 times throughout. But... its not called from in the fixed bank. So either it doesn't do what I think its doing or FF2 doesn't do battle messages from the fixed bank.

Edit: I remembered I can swap RAM.

https://cdn.discordapp.com/attachments/527351555779723266/663324284969811968/uuhhhh.png

Message to RAM #1. Screen buffer to RAM #2, Ram #1 to screen buffer when drawing. Same addresses, same boxes! "Behind the box" gets saved to RAM #2, undrawing only requires swapping a box-shape's row of that back to the screen buffer. Should be SUPER FAST?
« Last Edit: January 05, 2020, 05:20:00 am by Jiggers »
I know exactly what I'm doing. I just don't know what effect it's going to have.

I wrote some NES music! Its a legal ROM file. - I got a Ko-Fi page too.

Vanya

  • Hero Member
  • *****
  • Posts: 1562
    • View Profile
Re: FF1 MMC5 Disassembly Updates
« Reply #467 on: January 07, 2020, 07:03:23 am »
That is a sound analysis, I think.
Anything that will prevent all the boxes from being rebuilt entirely from the beginning should speed things up.

Jiggers

  • Sr. Member
  • ****
  • Posts: 308
    • View Profile
    • My Ko-Fi Page
Re: FF1 MMC5 Disassembly Updates
« Reply #468 on: January 08, 2020, 01:53:07 am »
I miscalculated something...

I gotta learn how to make another branch of my own thing so I can upload this without breaking the last version, and figure out how to download the last one so I can see how it was before I mucked things up.

How many tiles does the battle magic list box use? Is it #320? Screen width (32), 10 tiles high... $0A * $20...

Ugh, somehow I calculated it as using #198 tiles. I forgot to include the spaces between text rows. Okay, there's 1552 bytes left, current decompressed box RAM is 1248... 304 of that is one-line boxes. If I just go with the idea that I'll need to expand be twice the size, that's 2192... or 944 more bytes needed to fix the mistake. Cutting it close, but it still works. Haven't calculated in the possible skill selection box or the Scan box though. Can save some space, maybe, for boxes that share sizes. The command box is the same size as the item box, but is drawn to a different spot. If the command box undraws before the item box is drawn, then it should be possible to merge them. The confirm box as well! Okay, not a total disaster.

The good news progress: I've gotten to the point where my RAM boxes are being drawn to the screen. And since it draws based on width, its not doing $20 draws per row either! At least not for EVERY box.

And woah, space in the fixed bank is growing again. 1306 bytes at the moment. Will be a little less when the boxes work properly. Maybe more though, because...

Since the whole bit where battle messages are stored as blocks is done with, I'm not completely sure the separate FormatBattleString routine is needed? I have to convert a lot of battle strings--the commands, the roster box, the player names and HP--so maybe they'll work just fine as the game's usual strings. DrawComplexString draws to the screen, sure, but why can't they at least share the same decompression routines? (I'd have to compare them both properly to make sure about this.)



I think I made a new branch, I called it Breaking Boxes.

I really am not liking GitHub's apparent randomness. Its lucky I have my changes stored in Notepad++ so I can save over it when it decides to revert them on me.

I have folders on my computer, "FF1-MMC5" and "FF1_Stable"--the first one used to be the main repository, but that's now my testing branch folder, while "Stable" is a fresh download of the main repository. When I open GitHub Desktop, it seems to immediately download the stable stuff into my testing folder. The terminology if everything makes it so hard to know what exactly I'm doing with this! I have two "FF1-MMC5"s in my repository list, I can't figure out how to rename one to tell them apart without hovering the mouse over to see the folder name pop up.

Anyway, I think about one third done the box stuff. RAM shouldn't be an issue after all. Its only 1969 bytes for all the box shapes so far, and that's with spreading them out and aligning them to $20 so its easier to see where they start and end.

Next part will either be undrawing the boxes, or putting the preset text strings inside them, followed by figuring out how to update player HP with the new system, since re-drawing the same box will currently just wipe out what was behind it.
« Last Edit: January 08, 2020, 06:06:14 pm by Jiggers »
I know exactly what I'm doing. I just don't know what effect it's going to have.

I wrote some NES music! Its a legal ROM file. - I got a Ko-Fi page too.

Vanya

  • Hero Member
  • *****
  • Posts: 1562
    • View Profile
Re: FF1 MMC5 Disassembly Updates
« Reply #469 on: January 09, 2020, 11:57:40 am »
https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/creating-and-deleting-branches-within-your-repository

This says how.
Basically you go to the button in the main project that says "Branch: master", click it and in the search box type in a new name and it will show you a new button that says "Create branch: ***".
Just hit that button and it'll make you a new branch.

You can download the latest one from the site as normal, I think.
Unless you mean a previous version. Then I dunno.
« Last Edit: January 09, 2020, 12:11:07 pm by Vanya »

Jiggers

  • Sr. Member
  • ****
  • Posts: 308
    • View Profile
    • My Ko-Fi Page
Re: FF1 MMC5 Disassembly Updates
« Reply #470 on: January 12, 2020, 12:27:35 am »
Ah, thanks. Hopefully it will help when I switch back.

I've got undrawing working, and some box strings. Player name and HP, enemy roster (minor bug), Command box (complete with updating the skill for each class!), two thirds of the Confirm box (Charge? and Run Away? work but I can't see if the normal "Ready?" one displays nicely.)

Bug with the roster is that it seems to triple enemy totals? 3 imps is 9 imps for some reason. Haven't looked into why yet.

Still seeing a flicker now and then, but that should be fixed by doing a proper Vblank call right before doing the main box work. Doing that before wouldn't have worked, I don't think... At least I hope not, because if it would have worked, then I did all this for a lot of nothing.  :'(

Magic, Items, Equipment, Scan, and the Ether box are left. These are troublesome. Ether box should be easy, its just a string that has to be built. Item box scrolls, so it never really used the box drawing routine for text. But I want it to! So that each line is drawn with the top of the box already there, rather than printed in later; then scrolling can do what it did before after.

Then I thought: Magic should scroll too. So I'm in the process of re-writing that from scratch as well. Equipment box won't scroll, but probably needs to be re-done anyway.

A lot of code is disabled while I work out the kinks and variable names for things. So ending a battle probably crashes the game. Right now I can't even select Fight 4 times in a row without a crash. And somehow the crashes are corrupting save RAM.

One thing I'm looking forward to is box content being easier to make up. For this system, its simply a matter of adding more bytes to some LUTs and putting the string somewhere. Right now the strings are in the fixed bank, but they could be moved to make more space. And the REALLY cool thing that I think I can do, is combined with the battle turn counter and enemy AI changes (maybe some more changes), or perhaps using certain battle IDs (so that only the "boss" vampire does this and not every vampire)... I can set up battle dialogue!
I know exactly what I'm doing. I just don't know what effect it's going to have.

I wrote some NES music! Its a legal ROM file. - I got a Ko-Fi page too.

Vanya

  • Hero Member
  • *****
  • Posts: 1562
    • View Profile
Re: FF1 MMC5 Disassembly Updates
« Reply #471 on: January 12, 2020, 11:08:46 pm »
Dang! That sound awesome.
Some battle dialogue for more of the bosses would help to differentiate the ones that share graphics with normal enemies, though to be honest, I'll probably make new graphics for those bosses as well.
:3

Jiggers

  • Sr. Member
  • ****
  • Posts: 308
    • View Profile
    • My Ko-Fi Page
Re: FF1 MMC5 Disassembly Updates
« Reply #472 on: January 15, 2020, 01:54:03 am »
Closing in on Magic menu working again. Had to get distracted by completely re-organizing how complex strings are drawn. Because dealing with that branching mess was driving me crazy.

So some dumb, some maybe-smart, and some huh:

To try and save space while drawing MP, I thought, rather than try to calculate it, why not use the bits of code that already do that. Which ended up with this:

Code: [Select]
@DrawPlayerMP:
    LDA #BANK_MENUS
    JSR SwapPRG_L
    JSR DrawBattle_IncSrcPtr      ; inc the pointer to get the spell level
    LDA (btldraw_src), Y          ; load it
    PHA                           ; back it up
    CLC           
    ADC #$2C                      ; add the current MP stat byte to it
    JSR PrintCharStat
    LDA format_buf-1
    JSR DrawBattleString_DrawChar ; draws current MP
    LDA #$7A
    JSR DrawBattleString_DrawChar ; draws /
    PLA                           ; spell level byte
    CLC
    ADC #$34                      ; add maximum MP stat byte to it
    JSR PrintCharStat
    LDA format_buf-1   
    JMP DrawBattleString_DrawChar ; draws max MP

And this was great, by doing a stat code ($15) followed by $00-$07, you could print CurrentMP/MaxMP, in any battle message box! So long as char_index is set beforehand anyway.

Then, disaster! Control code $15 was only good for battle message boxes... but to scroll text inside a box, the same string is drawn by DrawComplexString, with line breaks and terminators set based on how far into the list the cursor is. So I had to program that same thing into DrawComplexString. So that's dumb.

And then, when trying to test this, even though the last 3 tiles are the only ones that need a complex routine to decode instead of just bally well printing it to the screen, the one row was TOO LONG to print inside VBlank.



The very last tile wouldn't make it. And then I thought, so WHY is this routine ALWAYS setting the exact PPU address before drawing a tile? When doing "STA $2007" already increments the destination to the right by one? So a little jumbling of code later, and it no longer does that; now it only explicitly sets the destination after waiting for VBlank or doing a line break. Right!

But then even with that change, this last tile barely makes it in on time! Huh.

But, it does. So it works. Yay!

I think I might look into the magic string creation routine just calculating the MP manually though. The $15 control code will still work nicely for the Ether box at least.

(Also, with adding a similar routine to the one I posted here in DrawComplexString, after my re-organization of the whole damn thing, it ended up only adding on like 3 bytes or something... at least when I last checked, before it was fully functional. I just hope no other parts are broken from it.)

Edit: Can you test the cursor responsiveness in menus in the stable versions? I don't like how there's a weird input delay set up for these battle menus. Its like sometimes the cursor shoots over super fast and sometimes it takes a few taps to move at all. Is it just me bothered by it?

And for some reason I can't select spells in the third column, now... guess that's tomorrow me's problem. Also gotta make sure selected spells actually match...
« Last Edit: January 15, 2020, 03:05:53 am by Jiggers »
I know exactly what I'm doing. I just don't know what effect it's going to have.

I wrote some NES music! Its a legal ROM file. - I got a Ko-Fi page too.

Leviathan Mist

  • Jr. Member
  • **
  • Posts: 50
    • View Profile
Re: FF1 MMC5 Disassembly Updates
« Reply #473 on: January 15, 2020, 10:07:32 pm »
Quite an ambitious project you have going on here. I don't have time to go through all 24 pages, but I'm curious, did you completely rewrite the sound engine? If so, how many channels are supported?

Vanya

  • Hero Member
  • *****
  • Posts: 1562
    • View Profile
Re: FF1 MMC5 Disassembly Updates
« Reply #474 on: January 15, 2020, 11:42:40 pm »
I'll try it out as soon as I get a chance.
Things have been a bit crazy lately.
In the middle securing a new place to move to.

Jiggers

  • Sr. Member
  • ****
  • Posts: 308
    • View Profile
    • My Ko-Fi Page
Re: FF1 MMC5 Disassembly Updates
« Reply #475 on: January 16, 2020, 12:14:16 am »
Quite an ambitious project you have going on here. I don't have time to go through all 24 pages, but I'm curious, did you completely rewrite the sound engine? If so, how many channels are supported?

I haven't, and don't think I will. There's a lot of homebrew sound engines that people seem to prefer already, if someone wants to use something else. What I HAVE done is...

Quote
* Music code changes:
   Added support for MMC5's 2 square channels
   Added a bass octave
   Made use of unused instrument envelopes and song tempos to add custom ones
   Added a GOTO and RETURN control codes for the music score
   Added an Alternative Loop control code, that jumps to a new part of the score on the second read
        (Example: A song goes "C A G A E * D F" in one loop--on the second loop, it goes "C A G A E * B A")

   Added a control code to set the channel volume to 50% on top of any other volume reduction
   Added a control code to set the channel volume to 25% on top of any other volume reduction
   Added a control code that subtracts X from the volume, where X is the byte after the control code
   Almost all original game songs have been given a delay track using the 25% volume control code
   Most original game songs now use the MMC5 Squares when possible, leaving the original NES Square 2 available for SFX

So that's 4 square channels, the triangle... Still no noise track for drums. I've mostly swapped the various menu/damage tile sound effects out for noise instead. No DPCM stuff either, though I do use its register to help mute the triangle when in the menu (I haven't coded it to work for muting the triangle in normal music though.)

In message box news, there's only Scan left. I think I'm going to not be doing the Skill box--getting near that "don't wanna work on this anymore" stage again, so putting a lid on feature creep. Bug fixes from here on out unless something is super easy to do.

Bugs so far: Selecting an equipment item crashes the game (noticed this before I started working on the boxes), and the enemy roster box only displays "Imp   9" because I moved the location of the enemy stuff in RAM and I really don't know why that screwed up. Both fixed. Player HP box still needs to have its updating logic fixed...

Untested: Magic casting properly or not.

Also should mention, In tweaking the ComplexString code, I added another little control code for variable width character names. So "$10, $00" draws the first character's name with the fixed with (all the blank spaces if their name is less than 7 letters.) But "$10, $43" removes the spaces at the end. Dialogue can print the first character's name like this just fine, but for menus you really want the fixed width names... except I wanted it to not have spaces when drawing strings like, "X learned the spell!" So now there's that!
« Last Edit: January 16, 2020, 01:51:46 am by Jiggers »
I know exactly what I'm doing. I just don't know what effect it's going to have.

I wrote some NES music! Its a legal ROM file. - I got a Ko-Fi page too.

Vanya

  • Hero Member
  • *****
  • Posts: 1562
    • View Profile
Re: FF1 MMC5 Disassembly Updates
« Reply #476 on: January 16, 2020, 01:21:42 pm »
The cursor speed and reaction time in the previous version is perfectly fine on my end.
I tried out the broken boxes branch you are working on. Definitely not ready to use :P.
Crashed as soon as I pressed a button in a battle.

Jiggers

  • Sr. Member
  • ****
  • Posts: 308
    • View Profile
    • My Ko-Fi Page
Re: FF1 MMC5 Disassembly Updates
« Reply #477 on: January 17, 2020, 01:55:32 am »
I think I got magic spells working, the equipment box doing stuff... And worked out a wonky fix for HP. I just need to go over the entire game's logic for when to open and close boxes, because something is wrong there. Player attacks enemy, their name box isn't drawn--boxes are never undrawn, except for the player's HP box?? So I'll keep plugging away at it and then just update it all in one go I guess.

Did it crash exactly when you first pressed a button? So the first two boxes got drawn right, at least?

January 17, 2020, 08:08:48 pm - (Auto Merged - Double Posts are not allowed before 7 days.)
HEY HEY Who wants to help with some math? NEVERMIND I SOLVED IT!!!



What did not work:
Code: [Select]
    LDA tmp+12     ; Y position of box upper left corner
    LDX #32        ; screen width
    JSR MultiplyXA ; MMC5 registers, A is low byte, X is high byte of result
    STA tmp
    STX tmp+1
   
    DEC tmp+11     ; height
    LDA tmp+6      ; width
    LDX tmp+11     ; height - 1
    JSR MultiplyXA
    CLC
    ADC tmp+4      ; add X position
    ADC tmp        ; add low byte of Y * 32 result
    ADC #$80       ; add PPU destination start address low byte
    STA btldraw_dst
   
    TXA            ; high byte of width * height-1 result     
    CLC
    ADC tmp+1      ; add high byte of Y * 32 result
    ADC $22        ; add PPU destination start address high byte
    STA btldraw_dst+1

I have just a killer headache today so I'm way off my thinking skills...

Edit: And with that, boxes now undraw properly!!! HP updating and End of Battle logic left!!!

UPDATE: I think its done? Magic isn't selecting right still, but all the boxes draw, I don't see any flicker with my short test, and I don't hear any double-frames of music.
« Last Edit: January 18, 2020, 02:50:27 am by Jiggers »
I know exactly what I'm doing. I just don't know what effect it's going to have.

I wrote some NES music! Its a legal ROM file. - I got a Ko-Fi page too.

Vanya

  • Hero Member
  • *****
  • Posts: 1562
    • View Profile
Re: FF1 MMC5 Disassembly Updates
« Reply #478 on: February 21, 2020, 10:54:12 pm »
Just a quick reply to state that I'm finally ready to do some more testing.
Finally finished moving to my new place and got a good chunk of the unpacking done.

I just hope poor Jiggers hasn't finally been slain by this beast! :P

Jiggers

  • Sr. Member
  • ****
  • Posts: 308
    • View Profile
    • My Ko-Fi Page
Re: FF1 MMC5 Disassembly Updates
« Reply #479 on: March 04, 2020, 12:25:25 am »
That seems safe to assume.

I completely lost track of what I was doing. I just tested out a battle and every single command was borked, then it froze after an Ocho poisoned me. Enemy roster box didn't display the names correctly. I have no idea where anything I was working on is located in the files anymore... Until I feel that itch to code again, I don't really have any desire to figure out where I was and start working through these issues. I was bored for a bit so I thought I'd try it, but nope... passion's not there. Just got annoyed at how much is still broken. Sorry!
I know exactly what I'm doing. I just don't know what effect it's going to have.

I wrote some NES music! Its a legal ROM file. - I got a Ko-Fi page too.