Romhacking.net

Romhacking => Personal Projects => Topic started by: TimeSpaceMage on July 18, 2017, 07:44:56 pm

Title: Arcana - Seal of Rimsala! (SNES) ~ FastROM bug fixed! ...kinda.
Post by: TimeSpaceMage on July 18, 2017, 07:44:56 pm
Hello, everyone! This is my improvement project for Arcana, aka Card Master in Japan. It's one of my first and favorite RPGs growing up. Arcana is an early 90's dungeon crawler with maps that draw themselves as you progress, catchy woodwind music, and a charmingly quaint 4-element battle system: Wind beats Earth beats Water beats Fire beats Wind.

On the other hand: there's a very high encounter rate, the script is Engrishy and full of unneeded capitalization, and (as is typical of early 90's Nintendo games) it's full of religious censorship. Well hey, I can fix that! And so this started as just a script fix, until I learned to edit even more and make the game more interesting. This mod showcases edits to most of the following, because I can!
-Equipment, monster and spell statistics
-Music and sfx used
-Treasure chest contents
-Spell animations
-Character level-up stats and spell lists
-Stage Select starting inventory
-Inventory limits (max # of items)
-Various formatted text

Thanks to rainponcho for the following:
-Decreased encounter rate (Fog Cards are still cheaper for speedrunners.)
-FastROM conversion and 37-47% faster walk speed (Most noticeable in Bintel Castle)
-Multi-levelup patch (https://www.sendspace.com/file/m2jjo8) that supports carrying over leftover EXP towards the next level

As for future content I'd like before a public release:
-Fix armor in damage calculation. Armor does jack diddly to lower damage, and can be skipped.
-Fix a text issue where some items and spells are written with a trailing space ("learned Change Attribute to Wind .")
-Work out the damage formula and other mechanics.

Finally, here are some before-and-after pics of Vanilla compared with Seal of Rimsala v0.93. Enjoy!
(http://i.imgur.com/jMjXlan.png)(http://i.imgur.com/78aJDbJ.png)
(http://i.imgur.com/mmjMMID.png)(http://i.imgur.com/mNk1NnK.png)
(http://i.imgur.com/0TGDled.png)(http://i.imgur.com/I2NPw9k.png)
(http://i.imgur.com/NJYwUz4.png)(http://i.imgur.com/39jYR79.png)(http://i.imgur.com/FXqZA3m.png)
Title: Re: Arcana - Seal of Rimsala! (SNES)
Post by: SunGodPortal on July 18, 2017, 07:59:01 pm
Cool. It's nice to see someone working on this game. I only played it a little bit but I def thought it was neat. Most SNES games I've played from this era that were similar had artwork that was far less charming if not downright ugly.
Title: Re: Arcana - Seal of Rimsala! (SNES)
Post by: KirkyMonster on July 18, 2017, 08:12:20 pm
I've never heard of this game but it looks really cool and reading your description of the game and the changes you are making sound intriguing.
Title: Re: Arcana - Seal of Rimsala! (SNES)
Post by: Zoinkity on July 19, 2017, 09:42:55 am
Always thought I was crazy going into dungeons naked but wow, armor really doesn't do anything after all!
Title: Re: Arcana - Seal of Rimsala! (SNES)
Post by: Time/SpaceMage on July 19, 2017, 11:37:50 am
The only things I've found that decrease physical damage are the Endurance stat, Wall All/Attack Impair, elemental advantage, and armor with a race bonus (like Mithril vs undead).

Incidentally, buffs and debuffs cancel each other, like Haste and Slow in FF6. They're flags for each character, so one cast is enough for the whole battle.
Title: Re: Arcana - Seal of Rimsala! (SNES)
Post by: goldenband on July 19, 2017, 01:23:02 pm
Looking good! This should be a nice spruce-up for a deserving game. :)
Title: Re: Arcana - Seal of Rimsala! (SNES)
Post by: rainponcho on July 19, 2017, 11:12:10 pm
If you know asm, this is where the random encounter logic is:

Code: [Select]
$18/802E AD F5 16    LDA $16F5  [$00:16F5]   A:FFFF X:0012 Y:0074 D:1E00 DB:00 S:1FF3 P:eNvmxdIzC HC:0890 VC:008 FC:47 I:00
$18/8031 C9 10 00    CMP #$0010              A:0010 X:0012 Y:0074 D:1E00 DB:00 S:1FF3 P:envmxdIzC HC:0938 VC:008 FC:47 I:00
$18/8034 90 0A       BCC $0A    [$8040]      A:0010 X:0012 Y:0074 D:1E00 DB:00 S:1FF3 P:envmxdIZC HC:0970 VC:008 FC:47 I:00
$18/8036 C9 20 00    CMP #$0020              A:0010 X:0012 Y:0074 D:1E00 DB:00 S:1FF3 P:envmxdIZC HC:0994 VC:008 FC:47 I:00
$18/8039 90 09       BCC $09    [$8044]      A:0010 X:0012 Y:0074 D:1E00 DB:00 S:1FF3 P:eNvmxdIzc HC:1026 VC:008 FC:47 I:00
$18/8044 A2 0C 00    LDX #$000C              A:0010 X:0012 Y:0074 D:1E00 DB:00 S:1FF3 P:eNvmxdIzc HC:1056 VC:008 FC:47 I:00
$18/8047 80 03       BRA $03    [$804C]      A:0010 X:000C Y:0074 D:1E00 DB:00 S:1FF3 P:envmxdIzc HC:1088 VC:008 FC:47 I:00
..


throw rng dice
$18/804C 48          PHA                     A:0010 X:000C Y:0074 D:1E00 DB:00 S:1FF3 P:envmxdIzc HC:1152 VC:008 FC:47 I:00
$18/804D 8A          TXA                     A:0010 X:000C Y:0074 D:1E00 DB:00 S:1FF1 P:envmxdIzc HC:1190 VC:008 FC:47 I:00
$18/804E 22 F1 89 00 JSL $0089F1[$00:89F1]   A:000C X:000C Y:0074 D:1E00 DB:00 S:1FF1 P:envmxdIzc HC:1212 VC:008 FC:47 I:00


==============>

$00/89F1 48          PHA                     A:00FA X:0012 Y:0002 D:1E00 DB:00 S:1FF3 P:envmxdIzc HC:1004 VC:251 FC:29 I:00
$00/89F2 DA          PHX                     A:00FA X:0012 Y:0002 D:1E00 DB:00 S:1FF1 P:envmxdIzc HC:1042 VC:251 FC:29 I:00
$00/89F3 A2 0B 00    LDX #$000B              A:00FA X:0012 Y:0002 D:1E00 DB:00 S:1FEF P:envmxdIzc HC:1080 VC:251 FC:29 I:00
$00/89F6 0E 0A 00    ASL $000A  [$00:000A]   A:00FA X:000B Y:0002 D:1E00 DB:00 S:1FEF P:envmxdIzc HC:1112 VC:251 FC:29 I:00
$00/89F9 E2 20       SEP #$20                A:00FA X:000B Y:0002 D:1E00 DB:00 S:1FEF P:envmxdIzc HC:1182 VC:251 FC:29 I:00
$00/89FB 2A          ROL A                   A:00FA X:000B Y:0002 D:1E00 DB:00 S:1FEF P:envMxdIzc HC:1212 VC:251 FC:29 I:00
$00/89FC 2A          ROL A                   A:00F4 X:000B Y:0002 D:1E00 DB:00 S:1FEF P:eNvMxdIzC HC:1234 VC:251 FC:29 I:00
$00/89FD 4D 0A 00    EOR $000A  [$00:000A]   A:00E9 X:000B Y:0002 D:1E00 DB:00 S:1FEF P:eNvMxdIzC HC:1256 VC:251 FC:29 I:00
$00/8A00 2A          ROL A                   A:00CD X:000B Y:0002 D:1E00 DB:00 S:1FEF P:eNvMxdIzC HC:1296 VC:251 FC:29 I:00
$00/8A01 4D 0A 00    EOR $000A  [$00:000A]   A:009B X:000B Y:0002 D:1E00 DB:00 S:1FEF P:eNvMxdIzC HC:1318 VC:251 FC:29 I:00
$00/8A04 4A          LSR A                   A:00BF X:000B Y:0002 D:1E00 DB:00 S:1FEF P:eNvMxdIzC HC:1358 VC:251 FC:29 I:00
$00/8A05 4A          LSR A                   A:005F X:000B Y:0002 D:1E00 DB:00 S:1FEF P:envMxdIzC HC:0016 VC:252 FC:29 I:00
$00/8A06 49 FF       EOR #$FF                A:002F X:000B Y:0002 D:1E00 DB:00 S:1FEF P:envMxdIzC HC:0038 VC:252 FC:29 I:00
$00/8A08 29 01       AND #$01                A:00D0 X:000B Y:0002 D:1E00 DB:00 S:1FEF P:eNvMxdIzC HC:0062 VC:252 FC:29 I:00
$00/8A0A 0D 0A 00    ORA $000A  [$00:000A]   A:0000 X:000B Y:0002 D:1E00 DB:00 S:1FEF P:envMxdIZC HC:0086 VC:252 FC:29 I:00
$00/8A0D 8D 0A 00    STA $000A  [$00:000A]   A:0024 X:000B Y:0002 D:1E00 DB:00 S:1FEF P:envMxdIzC HC:0126 VC:252 FC:29 I:00
$00/8A10 C2 20       REP #$20                A:0024 X:000B Y:0002 D:1E00 DB:00 S:1FEF P:envMxdIzC HC:0166 VC:252 FC:29 I:00
$00/8A12 CA          DEX                     A:0024 X:000B Y:0002 D:1E00 DB:00 S:1FEF P:envmxdIzC HC:0196 VC:252 FC:29 I:00
$00/8A13 D0 E1       BNE $E1    [$89F6]      A:0024 X:000A Y:0002 D:1E00 DB:00 S:1FEF P:envmxdIzC HC:0218 VC:252 FC:29 I:00
$00/8A15 FA          PLX                     A:00C2 X:0000 Y:0002 D:1E00 DB:00 S:1FEF P:envmxdIZC HC:1310 VC:255 FC:29 I:00
$00/8A16 68          PLA                     A:00C2 X:0012 Y:0002 D:1E00 DB:00 S:1FF1 P:envmxdIzC HC:1354 VC:255 FC:29 I:00
$00/8A17 F0 19       BEQ $19    [$8A32]      A:00FA X:0012 Y:0002 D:1E00 DB:00 S:1FF3 P:envmxdIzC HC:0034 VC:256 FC:29 I:00
$00/8A19 E2 20       SEP #$20                A:00FA X:0012 Y:0002 D:1E00 DB:00 S:1FF3 P:envmxdIzC HC:0058 VC:256 FC:29 I:00
$00/8A1B 8F 02 42 00 STA $004202[$00:4202]   A:00FA X:0012 Y:0002 D:1E00 DB:00 S:1FF3 P:envMxdIzC HC:0088 VC:256 FC:29 I:00
$00/8A1F AD 0A 00    LDA $000A  [$00:000A]   A:00FA X:0012 Y:0002 D:1E00 DB:00 S:1FF3 P:envMxdIzC HC:0134 VC:256 FC:29 I:00
$00/8A22 8F 03 42 00 STA $004203[$00:4203]   A:00C2 X:0012 Y:0002 D:1E00 DB:00 S:1FF3 P:eNvMxdIzC HC:0174 VC:256 FC:29 I:00
$00/8A26 EA          NOP                     A:00C2 X:0012 Y:0002 D:1E00 DB:00 S:1FF3 P:eNvMxdIzC HC:0220 VC:256 FC:29 I:00
$00/8A27 C2 20       REP #$20                A:00C2 X:0012 Y:0002 D:1E00 DB:00 S:1FF3 P:eNvMxdIzC HC:0242 VC:256 FC:29 I:00
$00/8A29 AF 16 42 00 LDA $004216[$00:4216]   A:00C2 X:0012 Y:0002 D:1E00 DB:00 S:1FF3 P:eNvmxdIzC HC:0272 VC:256 FC:29 I:00
$00/8A2D 29 00 FF    AND #$FF00              A:BD74 X:0012 Y:0002 D:1E00 DB:00 S:1FF3 P:eNvmxdIzC HC:0324 VC:256 FC:29 I:00
$00/8A30 EB          XBA                     A:BD00 X:0012 Y:0002 D:1E00 DB:00 S:1FF3 P:eNvmxdIzC HC:0356 VC:256 FC:29 I:00
$00/8A31 6B          RTL                     A:00BD X:0012 Y:0002 D:1E00 DB:00 S:1FF3 P:eNvmxdIzC HC:0384 VC:256 FC:29 I:00


$18/8052 7A          PLY                     A:0007 X:000C Y:0074 D:1E00 DB:00 S:1FF1 P:envmxdIzC HC:0884 VC:013 FC:47 I:00
$18/8053 AA          TAX                     A:0007 X:000C Y:0010 D:1E00 DB:00 S:1FF3 P:envmxdIzC HC:0928 VC:013 FC:47 I:00
$18/8054 D0 EA       BNE $EA    [$8040]      A:0007 X:0007 Y:0010 D:1E00 DB:00 S:1FF3 P:envmxdIzC HC:0950 VC:013 FC:47 I:00



random encounter
$18/8056 AD CD 18    LDA $18CD  [$00:18CD]   A:0000 X:0000 Y:0010 D:1E00 DB:00 S:1FF3 P:envmxdIZC HC:1050 VC:013 FC:15 I:00
$18/8059 3A          DEC A                   A:0001 X:0000 Y:0010 D:1E00 DB:00 S:1FF3 P:envmxdIzC HC:1098 VC:013 FC:15 I:00
$18/805A 0A          ASL A                   A:0000 X:0000 Y:0010 D:1E00 DB:00 S:1FF3 P:envmxdIZC HC:1154 VC:013 FC:15 I:00
$18/805B AA          TAX                     A:0000 X:0000 Y:0010 D:1E00 DB:00 S:1FF3 P:envmxdIZc HC:1176 VC:013 FC:15 I:00
$18/805C BF 3D 91 18 LDA $18913D,x[$18:913D] A:0000 X:0000 Y:0010 D:1E00 DB:00 S:1FF3 P:envmxdIZc HC:1198 VC:013 FC:15 I:00
$18/8060 85 18       STA $18    [$00:1E18]   A:9147 X:0000 Y:0010 D:1E00 DB:00 S:1FF3 P:eNvmxdIzc HC:1254 VC:013 FC:15 I:00
$18/8062 A9 18 00    LDA #$0018              A:9147 X:0000 Y:0010 D:1E00 DB:00 S:1FF3 P:eNvmxdIzc HC:1294 VC:013 FC:15 I:00
$18/8065 85 1A       STA $1A    [$00:1E1A]   A:0018 X:0000 Y:0010 D:1E00 DB:00 S:1FF3 P:envmxdIzc HC:1326 VC:013 FC:15 I:00
$18/8067 98          TYA                     A:0018 X:0000 Y:0010 D:1E00 DB:00 S:1FF3 P:envmxdIzc HC:1366 VC:013 FC:15 I:00
$18/8068 29 0F 00    AND #$000F              A:0010 X:0000 Y:0010 D:1E00 DB:00 S:1FF3 P:envmxdIzc HC:0024 VC:014 FC:15 I:00
$18/806B F0 10       BEQ $10    [$807D]      A:0000 X:0000 Y:0010 D:1E00 DB:00 S:1FF3 P:envmxdIZc HC:0056 VC:014 FC:15 I:00

Now check this value:
$18/8044 A2 0C 00    LDX #$000C

That's your standard rng seeder. Higher for less encounters. Lower for quick grinding.


Pretty nice changes so far.
Title: Re: Arcana - Seal of Rimsala! (SNES)
Post by: Reiska on July 20, 2017, 03:05:09 am
Oh man, so looking forward to this.  I loooooove Arcana.

Incidentally, do you have a complete list of all the armors that do have a race bonus and are thus worth buying?
Title: Re: Arcana - Seal of Rimsala! (SNES)
Post by: TimeSpaceMage on July 20, 2017, 07:33:39 pm
Oh wow rainponcho, how did you find that data so quickly? You're a lifesaver! And yes I'm learning ASM, so I can read that (albeit slowly; that looks complicated!). Nice to see more known data for bank $18; so far I only found treasure chest contents there.

Speaking of treasure chests, their value is in 4 bytes but only GP uses all 4. The 1st byte is the type (00=cards, 01=items, 02=equipment, 03=gold) while the 2nd byte is value or ID. For instance, "02 01" would be a Dagger while "01 06" is Intelligence Honey. Fun thing is, there's an unused type in the game  ;)
Spoiler:
If you change the type to "04", Rooks says "Oh no!" and a battle starts! So there's Monsters-in-a-box, although they don't leave an item and it seems to be just a random encounter. Neat surprise, though.


Oh man, so looking forward to this.  I loooooove Arcana.

Incidentally, do you have a complete list of all the armors that do have a race bonus and are thus worth buying?
Why yes, I do  :)
I made some tables on Data Crystal (http://datacrystal.romhacking.net/wiki/Arcana) awhile back. Just pick the Equipment Listing. (Also if you feel like messing around, the RAM map has your X/Y position so you can jump around the map. Just move to refresh the display afterwards.)
Title: Re: Arcana - Seal of Rimsala! (SNES)
Post by: rainponcho on July 20, 2017, 08:16:34 pm
Geiger snes9x debugger. Used trace logs and toggle on/off until I triggered the encounter. Then kept breakpoint testing from last written log until I got what I wanted. It's nice when the method works quickly.

I thought the game was written confusing enough and just picked out details that resemble other games. Admittedly I didn't bother to read most of the code like that rng :)
(kinda reminds me of some noise feedback generators)


You really know this game inside-out. :mrgreen:
Title: Re: Arcana - Seal of Rimsala! (SNES)
Post by: TimeSpaceMage on July 20, 2017, 08:45:14 pm
Geiger snes9x debugger. Used trace logs and toggle on/off until I triggered the encounter. Then kept breakpoint testing from last written log until I got what I wanted. It's nice when the method works quickly.

I thought the game was written confusing enough and just picked out details that resemble other games. Admittedly I didn't bother to read most of the code like that rng :)
(kinda reminds me of some noise feedback generators)


You really know this game inside-out. :mrgreen:
I'm using the debugger too, but it sounds like you know a lot more about tracing! So by toggle on/off you mean the * key? I'll use a frame advance to only log 1 frame and I still get 900 lines to parse through. How do you decide what to break on?

So looking through that, looks like it loops 0B times at 89F6, doing a bunch of shift and EOR operations to the random seed, then multiplies the result by the seed. And then... oh, if the result is 0 you get an encounter, otherwise it loads 0 in A and RTLs. Huh. I still don't see WHY a higher seed leads to fewer encounters, but it sure works.

And thanks; I've been researching this game on and off for 2 years. It helps that I'm really good at reading raw hex lol. I'd like to get better at using tools though. (I wrote a Python program to edit the game, but then I found out about Nightmare and made some editors in that.)
Title: Re: Arcana - Seal of Rimsala! (SNES)
Post by: rainponcho on July 20, 2017, 09:47:59 pm
This is my debug setting.
https://ibb.co/e6Zu4k

So I load up the dungeon. Choose a spot. Savestate.

First time:
Turn on logging - cpu. Wait maybe 10 seconds.

Repeat:
Load state. Turn on logging - cpu. Take a step. No encounter. Turn off logging.


I didn't get an encounter after awhile. So took 2 steps. And repeat.
Took 5 steps looping before I got a hit.


Today's last log throws me here. Bingo!
$18/8056 AD CD 18    LDA $18CD  [$00:18CD]
(yesterday it was elsewhere)


As for rng
$00/8A1B 8F 02 42 00 STA $004202[$00:4202]
==> this is our seed value

$00/8A22 8F 03 42 00 STA $004203
==> this is our randomly generated value from earlier shifting math

It multiplies the 2 8-bit #s together and gets 16-bits out. Or a 8.8 fixed-fractional value.


So our seed is 0C. It basically chooses a value between 00-0B. If we get 00, fight round. 1/12 = 8.333%

If our seed is 01. 1/1 = 100%
If our seed is 7F. 1/127 = 0.78%


Further math analysis. Seed = 0C.
- rng = 40h. 40 * 0C = 3[00] == 3
- rng = C0h. C0 * 0C = 9[00] == 9
- rng = FFh. BF4
- rng = 00h. 000. (*)
- rng = 15h. 0FC. (*)
- rng = 16h. 108. Fail.

00-15 = get ready!
16-FF = just you wait. My seed is low enough to catch you.


edit: My usage of 'seed' might be wrong here. But the idea works. :)
Title: Re: Arcana - Seal of Rimsala! (SNES)
Post by: TimeSpaceMage on July 20, 2017, 10:08:42 pm
I'll turn off Squelch, though I'm not sure what the extra flags are besides SP=stack pointer.

Had to play around with the calculator a bit, but ohhhhh okay, I get it! So if their product's high byte is 00, it's an encounter. That explains why a higher seed means fewer values that would still yield a product less than 0100f.

I halved the encounter rate for now, so it's 1/24 (4%) now. Also I found the sprite order for FINIS, and changed it to DEATH  :laugh: *smack* (https://upontheshelfreviews.files.wordpress.com/2016/03/mabel_death.jpg)

Now if I could find a way to increase the walk speed. It takes 2f holding forward and up to 21f each to move half a step! I'm poring over trace logs of 1f walking, but the most I've gathered is that it's looping through 846F0f-849DFf (the graphics for the half step, I believe) until it hits an FF. After that it spends an unreasonable amount of time looping around bank $03, followed by about 2850 lines of stalling.
Title: Re: Arcana - Seal of Rimsala! (SNES)
Post by: rainponcho on July 20, 2017, 10:42:17 pm
Summary of flags

A,X,Y = cpu registers
P = cpu flags
SP = stack
HC = horizontal line counter
VC = vertical line counter (useful for noting VBlank)
FC = frame counter ?


DB = bank
D = direct page
ex. DB:03, D:0100, lda $04 ==> read from 03:0100

It's D + DB that's more useful with squelch off. I got punished several times when you mvn/mvp or game uses dma and tosses banks around without you noticing. Lots of debugging time with crash burns.
Title: Re: Arcana - Seal of Rimsala! (SNES)
Post by: Time/SpaceMage on July 20, 2017, 11:26:21 pm
DB = bank
D = direct page
ex. DB:03, D:0100, lda $04 ==> read from 03:0100

It's D + DB that's more useful with squelch off. I got punished several times when you mvn/mvp or game uses dma and tosses banks around without you noticing. Lots of debugging time with crash burns.
Ohhhhh so that's why I couldn't find those darn registers half the time! I'd be staring at the [ ] like "where the heck did it get that from?"

What's that about VC and HC? Could you give an example?

Oh, and I edited that last post right when you posted yours.
Title: Re: Arcana - Seal of Rimsala! (SNES)
Post by: rainponcho on July 21, 2017, 12:31:02 pm
Looking at full trace log, I can't understand HC well enough either. For VC, screen has like 224 visisble lines. Then comes overscan to 239. Then the (something) period which stops at 262. Okay. I don't understand this enough to explain it to someone else. :)

Just ~224-225 onward is usually safe period when you can send/copy stuff to vram (when screen is on).



Unholy moley! Really slow drawing routine. :o
jsr 038F41 = eats up like 5 full nmi frames.

1st idea is to turn on FastRom. Set $30 flag in rom header and asm write $01 to 420d at bootup. Change some 00 code calls to 80 bank to get small appreciable boost.
(or I think you did this already?)


This loop here eats up a lot of cycles in a full trace log.

Code: [Select]
$00/8870 B9 00 00    LDA $0000,y[$7E:E335]   A:E3C0 X:E34B Y:E335 D:1DF8 DB:7E S:1FE6 P:envMxdIZC HC:0314 VC:149 FC:59 I:00
$00/8873 9D 00 00    STA $0000,x[$7E:E34B]   A:E301 X:E34B Y:E335 D:1DF8 DB:7E S:1FE6 P:envMxdIzC HC:0360 VC:149 FC:59 I:00
$00/8876 88          DEY                     A:E301 X:E34B Y:E335 D:1DF8 DB:7E S:1FE6 P:envMxdIzC HC:0406 VC:149 FC:59 I:00
$00/8877 E8          INX                     A:E301 X:E34B Y:E334 D:1DF8 DB:7E S:1FE6 P:eNvMxdIzC HC:0428 VC:149 FC:59 I:00
$00/8878 C2 20       REP #$20                A:E301 X:E34C Y:E334 D:1DF8 DB:7E S:1FE6 P:eNvMxdIzC HC:0450 VC:149 FC:59 I:00
$00/887A C6 03       DEC $03    [$00:1DFB]   A:E301 X:E34C Y:E334 D:1DF8 DB:7E S:1FE6 P:eNvmxdIzC HC:0480 VC:149 FC:59 I:00
$00/887C E2 20       SEP #$20                A:E301 X:E34C Y:E334 D:1DF8 DB:7E S:1FE6 P:envmxdIzC HC:0588 VC:149 FC:59 I:00
$00/887E D0 F0       BNE $F0    [$8870]      A:E301 X:E34C Y:E334 D:1DF8 DB:7E S:1FE6 P:envMxdIzC HC:0618 VC:149 FC:59 I:00

Code: [Select]
$00/87C4 B7 00       LDA [$00],y[$10:C58E]   A:0000 X:E000 Y:0001 D:1DF8 DB:7E S:1FE8 P:eNvMxdIzc HC:0442 VC:196 FC:58 I:00
$00/87C6 C8          INY                     A:0062 X:E000 Y:0001 D:1DF8 DB:7E S:1FE8 P:envMxdIzc HC:0504 VC:196 FC:58 I:00
$00/87C7 9D 00 00    STA $0000,x[$7E:E000]   A:0062 X:E000 Y:0002 D:1DF8 DB:7E S:1FE8 P:envMxdIzc HC:0526 VC:196 FC:58 I:00
$00/87CA E8          INX                     A:0062 X:E000 Y:0002 D:1DF8 DB:7E S:1FE8 P:envMxdIzc HC:0612 VC:196 FC:58 I:00
$00/87CB C2 20       REP #$20                A:0062 X:E001 Y:0002 D:1DF8 DB:7E S:1FE8 P:eNvMxdIzc HC:0634 VC:196 FC:58 I:00
$00/87CD C6 03       DEC $03    [$00:1DFB]   A:0062 X:E001 Y:0002 D:1DF8 DB:7E S:1FE8 P:eNvmxdIzc HC:0664 VC:196 FC:58 I:00
$00/87CF E2 20       SEP #$20                A:0062 X:E001 Y:0002 D:1DF8 DB:7E S:1FE8 P:envmxdIzc HC:0732 VC:196 FC:58 I:00
$00/87D1 D0 F1       BNE $F1    [$87C4]      A:0062 X:E001 Y:0002 D:1DF8 DB:7E S:1FE8 P:envMxdIzc HC:0762 VC:196 FC:58 I:00

Otherwise not sure yet how else to drop time. It runs lots of animation scripting language for what purpose? This could take some time to get it down. ^^
Title: Re: Arcana - Seal of Rimsala! (SNES)
Post by: Time/SpaceMage on July 21, 2017, 02:00:22 pm
Yeah I had a feeling this wasn't very optimal code. Haven't turned on FastROM before nor changed 00 calls to 80; could you explain the latter? I'll see about the former later tonight.

The kicker to trying to optimize this is that I have no idea what it's doing, or when it's branching over to something unrelated. Any tips on bank disassembly? I literally used the Disassemble option on a full bank and pasted to a file, then wrote a Python program to remove the flags and put a newline after each JSL/JSR. But going through, it can misread data as strings of BRK or get off by a byte.
 
Title: Re: Arcana - Seal of Rimsala! (SNES)
Post by: KingMike on July 21, 2017, 05:57:40 pm
Disassembling the full ROM isn't likely to get it right.
In addition to the 6502 problems in that it can mix code and data, and also indirect JMP (codes that read pointers from a table and then jump to the pointer. That's a problem since disassemblers won't be smart enough to know the table size and thus how many functions they should attempt to disassemble) , but also they may not be smart enough to account for the SEP/REP instructions.
(SEP and REP set certain processor flags. In particular to how they can mess up opcodes is that they can change A and X/Y to be 8-bit or 16-bit registers, which also affects the size of instructions that read them.)
Title: Re: Arcana - Seal of Rimsala! (SNES)
Post by: magictrufflez on July 21, 2017, 06:25:47 pm
No help to offer as far as hacking, but plenty of moral support from this corner!  I haven't played Arcana in a long time, bu it was one of those games I was very proud to have finally conquered when I finished it as a kid.  I do, however, suddenly feel silly for backtracking with Darwin to get him dressed properly after you first get him when the armor I bought did literally nothing....
Title: Re: Arcana - Seal of Rimsala! (SNES)
Post by: rainponcho on July 21, 2017, 07:10:01 pm
What I'd do is get a decent sized tracelog of all the important gameplay areas - dungeon, battle, menu, loading. Then parse it for any JSL / JML. Replace with HiRom banks.

We only get the slightly faster memory speed if we read/write/execute from $80-FF region. $00-7F will be default SlowRom.



So if we see any of these:
Code: [Select]
$03/8F2F 22 62 87 00 JSL $008762[$00:8762]   A:0010 X:C58D Y:E000 D:1E00 DB:7E S:1FF0 P:eNvmxdIzc HC:0536 VC:195 FC:57 I:00
==> 22 62 87 80  JSL $808762


$03/A2FA BF 79 A4 03 LDA $03A479,x[$03:A47F] A:0000 X:0006 Y:0001 D:1E00 DB:00 S:1FF1 P:envmxdIzC HC:0050 VC:001 FC:56 I:00
==> BF 79 A4 83  LDA $83A479,x


$03/A31C DF AF A3 03 CMP $03A3AF,x[$03:A3D7] A:0010 X:0028 Y:0001 D:1E00 DB:00 S:1FF1 P:envmxdIzc HC:1014 VC:001 FC:56 I:00
==> DF AF A3 83


$00/A2ED A9 00       LDA #$00                A:000A X:000A Y:0100 D:0000 DB:00 S:1E35 P:envMxdizc HC:0022 VC:015 FC:24 I:00
$00/A2EF 48          PHA                     A:0000 X:000A Y:0100 D:0000 DB:00 S:1E35 P:envMxdiZc HC:0046 VC:015 FC:24 I:00
$00/A2F0 AB          PLB                     A:0000 X:000A Y:0100 D:0000 DB:00 S:1E34 P:envMxdiZc HC:0076 VC:015 FC:24 I:00
==> A9 80 48 AB


$03/8F0B 9F 78 A6 7E STA $7EA678,x[$7E:A69E] A:0000 X:0026 Y:0026 D:1E00 DB:00 S:1FF1 P:envmxdIzc HC:0760 VC:005 FC:56 I:00
==> do not touch me (7E,7F,sram banks)


$00/9761 A7 10       LDA [$10]  [$01:8B29]   A:002C X:002C Y:8B28 D:1E00 DB:00 S:1FF6 P:eNvmxdIzc HC:0550 VC:006 FC:55 I:00
==> these are harder to track since they're ptrs somewhere in rom


$03/8F1E F4 7E 00    PEA $007E               A:0000 X:0000 Y:CCE1 D:1E00 DB:00 S:1FF1 P:envmxdIZc HC:0164 VC:195 FC:58 I:00
$03/8F21 AB          PLB                     A:0000 X:0000 Y:CCE1 D:1E00 DB:00 S:1FEF P:envmxdIZc HC:0212 VC:195 FC:58 I:00
==> have to be careful, 7E doesn't count

It's not important to get every single value. Just enough that runs in critical code areas. And wherever that original DB:00 value comes from. ^^


I did this only for decompression routine in Super Ghouls 'n Ghosts restoration (+ changed to vram dma loading) and average ~0.5 seconds shorter level load times. Which isn't alot (~30 NMI frames) but it might give a few more frames easy way through automation. Had I actually did a thorough changeover, I don't know whether I'd get another 0.5 second or more off.

You'll also want to edit the nmi, irq vectors from 00xxxx ==> 80xxxx. They should be somewhere around 7ff0 rom. Maybe some other snes hacker could comment more as I didn't experiment much with SlowRom --> FastRom yet.


I wouldn't have the skills to pull off a Nightcrawler speedup achievement (Glory of Heracles IV translation). Basically rewriting the engine and killing waste-of-time ideas.


edit: Someone could even write a "universal" automated tool that takes geiger / bsnes-plus logs and auto-patches loroms. Though I'm not so confident it'd fully fix up games like Gradius III slowdowns. Or Final Fight (Guy). But it's worth a thought?
(I'm not doing it)
Title: Re: Arcana - Seal of Rimsala! (SNES)
Post by: zombero on July 21, 2017, 09:03:11 pm
What makes you say armor doesn't do anything?  That's pretty contrary to what I've observed.
Title: Re: Arcana - Seal of Rimsala! (SNES)
Post by: Reiska on July 21, 2017, 09:30:26 pm
Did a bit of testing today with armor - I can confirm it does *something*, although the effect isn't exactly profound (in chapter 3, naked Rooks was taking about 6-8 more damage from attacks with no armor as compared to Breast Plate + Iron Shield).
Title: Re: Arcana - Seal of Rimsala! (SNES)
Post by: TimeSpaceMage on July 22, 2017, 12:25:32 am
OK, so it's not quite nothing. A more accurate statement would be "stats are wack"... which is why down the line I'd like to work out the damage formula and see if it's just using too little of certain stats. I recently learned about the multiplication registers, so maybe now I can make more sense of it. When I'm not looking into the rest of this, lol.

Disassembling the full ROM isn't likely to get it right.
In addition to the 6502 problems in that it can mix code and data, and also indirect JMP (codes that read pointers from a table and then jump to the pointer. That's a problem since disassemblers won't be smart enough to know the table size and thus how many functions they should attempt to disassemble) , but also they may not be smart enough to account for the SEP/REP instructions.
(SEP and REP set certain processor flags. In particular to how they can mess up opcodes is that they can change A and X/Y to be 8-bit or 16-bit registers, which also affects the size of instructions that read them.)

That makes sense! I'm a little fuzzy on JMP addressing modes, but I've seen SEP and REP plenty of times. Also gotta say, really big fan. Your posts have helped me learn so much ASM already!


What I'd do is get a decent sized tracelog of all the important gameplay areas - dungeon, battle, menu, loading. Then parse it for any JSL / JML. Replace with HiRom banks.

We only get the slightly faster memory speed if we read/write/execute from $80-FF region. $00-7F will be default SlowRom.
..
You'll also want to edit the nmi, irq vectors from 00xxxx ==> 80xxxx. They should be somewhere around 7ff0 rom. Maybe some other snes hacker could comment more as I didn't experiment much with SlowRom --> FastRom yet.


edit: Someone could even write a "universal" automated tool that takes geiger / bsnes-plus logs and auto-patches loroms. Though I'm not so confident it'd fully fix up games like Gradius III slowdowns. Or Final Fight (Guy). But it's worth a thought?
(I'm not doing it)

Parsing tracelogs... yeah, I could write a program to look for certain opcodes in a tracelog. I think it'd be safer if it just wrote those lines to a file rather than edit the ROM directly, since I don't trust addressing modes further than I can throw them. If someone wants to add that capability, I could look into putting it on Github later.

Meanwhile, sounds like I need to go research SlowROM->FastROM some more.
EDIT: Okay, I changed the flag in the internal header to $30. So the next step is to write my first ASM jump (*squeeing internally*) to set $420d. Going out on a limb here and presuming the huge block of FF's at 6020h-7FB0h is free.

Code: [Select]
$00/8001 18          CLC                     A:0000 X:0000 Y:0000 D:0000 DB:00 S:01FF P:EnvMXdIZc HC:0190 VC:000 FC:00 I:00
$00/8002 FB          XCE                     A:0000 X:0000 Y:0000 D:0000 DB:00 S:01FF P:EnvMXdIZc HC:0220 VC:000 FC:00 I:00
$00/8003 C2 10       REP #$10                A:0000 X:0000 Y:0000 D:0000 DB:00 S:01FF P:envMXdIZC HC:0250 VC:000 FC:00 I:00
$00/8005 E2 20       SEP #$20                A:0000 X:0000 Y:0000 D:0000 DB:00 S:01FF P:envMxdIZC HC:0288 VC:000 FC:00 I:00
$00/8007 A2 00 01    LDX #$0100              A:0000 X:0000 Y:0000 D:0000 DB:00 S:01FF P:envMxdIZC HC:0326 VC:000 FC:00 I:00
$00/800A 9A          TXS                     A:0000 X:0100 Y:0000 D:0000 DB:00 S:01FF P:envMxdIzC HC:0366 VC:000 FC:00 I:00
$00/800B A9 00       LDA #$00                A:0000 X:0100 Y:0000 D:0000 DB:00 S:0100 P:envMxdIzC HC:0396 VC:000 FC:00 I:00
$00/800D 48          PHA                     A:0000 X:0100 Y:0000 D:0000 DB:00 S:0100 P:envMxdIZC HC:0428 VC:000 FC:00 I:00
$00/800E AB          PLB                     A:0000 X:0100 Y:0000 D:0000 DB:00 S:00FF P:envMxdIZC HC:0466 VC:000 FC:00 I:00
$00/800F A9 8F       LDA #$8F                A:0000 X:0100 Y:0000 D:0000 DB:00 S:0100 P:envMxdIZC HC:0510 VC:000 FC:00 I:00
$00/8011 8D 00 21    STA $2100  [$00:2100]   A:008F X:0100 Y:0000 D:0000 DB:00 S:0100 P:eNvMxdIzC HC:0542 VC:000 FC:00 I:00
$00/8014 A9 00       LDA #$00                A:008F X:0100 Y:0000 D:0000 DB:00 S:0100 P:eNvMxdIzC HC:0628 VC:000 FC:00 I:00
$00/8016 8D 00 42    STA $4200  [$00:4200]   A:0000 X:0100 Y:0000 D:0000 DB:00 S:0100 P:envMxdIZC HC:0660 VC:000 FC:00 I:00

Looks like as good a place as any. So the code I want is...

Code: [Select]
$00/8019 22 30 60 80 JSL $806030
...
$80/6030 A9 01       LDA #$01
$80/6032 8D 0D 42    STA $420D
$80/6035 C2 10       REP #$10 (The 2 lines I'm replacing with the JSL)
$80/6037 E2 20       SEP #$20
$80/6039 6B          RTL

Oh, can I set DB to 80 here? Is there an instruction for that?
Title: Re: Arcana - Seal of Rimsala! (SNES)
Post by: Reiska on July 22, 2017, 01:46:21 am
I don't have any real insight on the damage formula mathematically, but some empirical observations of mine:
Title: Re: Arcana - Seal of Rimsala! (SNES)
Post by: Time/SpaceMage on July 22, 2017, 03:21:18 am
Yeah, that matches what I've observed in battle. The thing about finding hidden equipment/monster stats is that the tables are all 1 stat at a time for all items rather than all stats for 1 item at a time. It's hard to tell what's a table and what's not. For instance, monsters have Int values as I've found them in RAM (and given 999 Int to a monster to watch them wipe everyone with spells lol).

Attack power and battle damage are loaded into $16DB, and defense power into $16DD. But, they're shared by other stuff in battle too.

Oh, Alertness comes up a bunch in battle. According to my notes:
-Is read 3x per fighter at the end of the round (probably to determine turn order)   
-Read when an enemy whiffs   
-Read, then Endurance read when an enemy hits   
-Read when attacking   
-When attacking: Alertness/8 + 1, JSR C88B (isn't that the damage formula?)   
Title: Re: Arcana - Seal of Rimsala! (SNES)
Post by: rainponcho on July 22, 2017, 08:13:26 am
db starts here.
Code: [Select]
$00/800B A9 00       LDA #$00                A:0000 X:0100 Y:0000 D:0000 DB:00 S:0100 P:envMxdIzC HC:0356 VC:000 FC:00 I:00
$00/800D 48          PHA                     A:0000 X:0100 Y:0000 D:0000 DB:00 S:0100 P:envMxdIZC HC:0380 VC:000 FC:00 I:00
$00/800E AB          PLB                     A:0000 X:0100 Y:0000 D:0000 DB:00 S:00FF P:envMxdIZC HC:0410 VC:000 FC:00 I:00



I think you're choice of free area is probably safe.

Code: [Select]
$00/8019 22 30 E0 80 JSL $80E030
==> JML $80E030


$80/E030 A9 01       LDA #$01
$80/E032 8D 0D 42    STA $420D

$80/E035 C2 10       REP #$10 (The 2 lines I'm replacing with the JSL)
$80/E037 E2 20       SEP #$20
$80/E039 6B          RTL
==> JMP $801D

Your detour works but it'll RTL back to SlowRom area (00). We want to stay in FastRom. So JMP over ($80 -> $80). Then rest of init will go faster.


You might want to hijink the other vectors listed here:
http://www.smwiki.net/wiki/Vector_Info


I might give writing a small fastrom tool a try also, just to see how much it works.

(edit: I'm helping out on some snes projects that run into lorom slowdowns. So I guess I need it too. :))


edit2:
Another db here
Code: [Select]
$00/811A F4 00 00    PEA $0000               A:1E00 X:1FFF Y:0000 D:1E00 DB:00 S:1FFF P:envmxdIzC HC:1290 VC:002 FC:01 I:00
$00/811D AB          PLB                     A:1E00 X:1FFF Y:0000 D:1E00 DB:00 S:1FFD P:envmxdIzC HC:1338 VC:002 FC:01 I:00
$00/811E AB          PLB                     A:1E00 X:1FFF Y:0000 D:1E00 DB:00 S:1FFE P:envmxdIZC HC:0010 VC:003 FC:01 I:00


edit3:
Easier detour idea.

Reset vector is @ rom 7ffc. Change that to E030. Write 420d there. Then JML $808001 to finish it off.

Same for NMI, IRQ vectors. Except you just JML to $80xxxx. No hassle. :)

Use Lunar Address to convert rom  snes address.


edit4:
Tested fastrom. Same 20 frames to walk forward. No difference. Hmm. Stupid me.

Something else.


edit5:
Forgot to turn on Fastrom header. 23 clean -> 20 fastrom to take a step forward. Still slow. :|
Title: Re: Arcana - Seal of Rimsala! (SNES)
Post by: zombero on July 22, 2017, 09:11:29 am
Here are some things I remember from my brief time hacking this game:
-The difference between 1 Strength and 255 Strength is something to the tune of 1.5x to 2x damage.  So yeah, VERY minor.  It was definitely multiplicative, though.
-Endurance was in a similar boat, but I think it was even worse.  Compared to Endurance, Defense is actually pretty effective.  When I removed all my equipment in Stavery I started taking ~double damage from enemies.  The difference in Defense stat is the primary reason why humans take less damage than elementals.
-Intelligence reducing magic damage, as Reiska said, sounds right, though I don't really remember for certain.
-Buffs/Debuffs seem to have a rather meager impact, to the tune of maybe ~1/8 increase/decrease for the more observable stats.  The main exception to this is Dodge All which has a much more noticeable result.
Title: Re: Arcana - Seal of Rimsala! (SNES)
Post by: KingMike on July 22, 2017, 01:55:36 pm

EDIT: Okay, I changed the flag in the internal header to $30. So the next step is to write my first ASM jump (*squeeing internally*) to set $420d. Going out on a limb here and presuming the huge block of FF's at 6020h-7FB0h is free.

Code: [Select]
$00/8001 18          CLC                     A:0000 X:0000 Y:0000 D:0000 DB:00 S:01FF P:EnvMXdIZc HC:0190 VC:000 FC:00 I:00
$00/8002 FB          XCE                     A:0000 X:0000 Y:0000 D:0000 DB:00 S:01FF P:EnvMXdIZc HC:0220 VC:000 FC:00 I:00
$00/8003 C2 10       REP #$10                A:0000 X:0000 Y:0000 D:0000 DB:00 S:01FF P:envMXdIZC HC:0250 VC:000 FC:00 I:00
$00/8005 E2 20       SEP #$20                A:0000 X:0000 Y:0000 D:0000 DB:00 S:01FF P:envMxdIZC HC:0288 VC:000 FC:00 I:00
$00/8007 A2 00 01    LDX #$0100              A:0000 X:0000 Y:0000 D:0000 DB:00 S:01FF P:envMxdIZC HC:0326 VC:000 FC:00 I:00
$00/800A 9A          TXS                     A:0000 X:0100 Y:0000 D:0000 DB:00 S:01FF P:envMxdIzC HC:0366 VC:000 FC:00 I:00
$00/800B A9 00       LDA #$00                A:0000 X:0100 Y:0000 D:0000 DB:00 S:0100 P:envMxdIzC HC:0396 VC:000 FC:00 I:00
$00/800D 48          PHA                     A:0000 X:0100 Y:0000 D:0000 DB:00 S:0100 P:envMxdIZC HC:0428 VC:000 FC:00 I:00
$00/800E AB          PLB                     A:0000 X:0100 Y:0000 D:0000 DB:00 S:00FF P:envMxdIZC HC:0466 VC:000 FC:00 I:00
$00/800F A9 8F       LDA #$8F                A:0000 X:0100 Y:0000 D:0000 DB:00 S:0100 P:envMxdIZC HC:0510 VC:000 FC:00 I:00
$00/8011 8D 00 21    STA $2100  [$00:2100]   A:008F X:0100 Y:0000 D:0000 DB:00 S:0100 P:eNvMxdIzC HC:0542 VC:000 FC:00 I:00
$00/8014 A9 00       LDA #$00                A:008F X:0100 Y:0000 D:0000 DB:00 S:0100 P:eNvMxdIzC HC:0628 VC:000 FC:00 I:00
$00/8016 8D 00 42    STA $4200  [$00:4200]   A:0000 X:0100 Y:0000 D:0000 DB:00 S:0100 P:envMxdIZC HC:0660 VC:000 FC:00 I:00

Looks like as good a place as any. So the code I want is...

Code: [Select]
$00/8019 22 30 60 80 JSL $806030
...
$80/6030 A9 01       LDA #$01
$80/6032 8D 0D 42    STA $420D
$80/6035 C2 10       REP #$10 (The 2 lines I'm replacing with the JSL)
$80/6037 E2 20       SEP #$20
$80/6039 6B          RTL

Oh, can I set DB to 80 here? Is there an instruction for that?

Is this HiROM or LoROM? (Although it can still technically vary between PCBs, it is usually enough to distinguish Hi or Lo ROM?)
Generally in "LoROM" games (SNES9x or ZSNES will tell you when the game loads), ROM is only mapped to address $8000-FFFF (the second part of the address). $6000-7FFF can vary between PCBs but is possibly SRAM.
(bank 00/80:8000 would map to the first 32KB of ROM, bank 01/81:8000 map to the second 32KB, etc.)
Title: Re: Arcana - Seal of Rimsala! (SNES)
Post by: TimeSpaceMage on July 23, 2017, 12:49:17 am
Not sure why my posts only have to wait on mod approval when I post on mobile, but I'll just repost this on PC now that I'm home.

Yes, it's LoROM. Oh I see, so those addresses are out of range. Phooey... that's a good lesson though. So I would need free space in one of the banks in the 8000+ range. There's another section of FFs from F990-FFFF.
Title: Re: Arcana - Seal of Rimsala! (SNES)
Post by: rainponcho on July 23, 2017, 08:04:27 am
LoROM can be a little funny to understand at first. FuSoYa's tool Lunar Address makes it easier to convert between raw file and snes addresses.

tool
http://fusoya.eludevisibility.org/la/index.html


ex.
Free space located at $6020 rom (file). Lunar Address shows us it's SNES LoROM address 00:E020. Or 80:E020 for FastROM.

Free space F990 (file) = 01:F990 (SNES, SlowRom, LoRom)  81:F990 (SNES, FastRom, LoRom)


Or here's a snippet from FastRom tester
Code: [Select]
arch snes.cpu; lorom


// lorom, fastrom
org $ffd5
db $30


// snes bootup
org $fffc
dw fastrom_start


// todo: snes irq, nmi remap



//$00/9532 A7 10       LDA [$10]  [$01:8CDE]   A:8761 X:000E Y:0001 D:1E00 DB:00 S:1FF6 P:eNvmxdIzc HC:0264 VC:259 FC:59 I:00
//
//$00/9534 29 FF 00    AND #$00FF              A:1103 X:000E Y:0001 D:1E00 DB:00 S:1FF6 P:envmxdIzc HC:0352 VC:259 FC:59 I:00

// snes $9534 = file $1532
org $9534
jsr fastrom_code1



// snes 80e020 = snes 00e020 = file 6020
org $80e020

fastrom_start:
// snes native mode
clc
xce

sep #$20
lda.b #$01
sta $420d

// 00xxxx ==> 808001
jml $808001



fastrom_code1:
and.w #$00ff

cmp.w #$0040
bcs fastrom_code1_done

// 24-bit ptr table code jumps  (00-3F ==> 80-BF)
ora.w #$0080

fastrom_code1_done:
rts


And patch to convert FastRom banks (code analysis).
https://www.sendspace.com/file/60krtf

Although I found a bug with how toll handles plb codes but there weren't many in this game. So I think it was okay - have to recheck.
Title: Re: Arcana - Seal of Rimsala! (SNES)
Post by: TimeSpaceMage on July 23, 2017, 12:15:23 pm
LoROM can be a little funny to understand at first. FuSoYa's tool Lunar Address makes it easier to convert between raw file and snes addresses.

tool
http://fusoya.eludevisibility.org/la/index.html


ex.
Free space located at $6020 rom (file). Lunar Address shows us it's SNES LoROM address 00:E020. Or 80:E020 for FastROM.

Free space F990 (file) = 01:F990 (SNES, SlowRom, LoRom)  81:F990 (SNES, FastRom, LoRom)


Or here's a snippet from FastRom tester
Code: [Select]
arch snes.cpu; lorom


// lorom, fastrom
org $ffd5
db $30


// snes bootup
org $fffc
dw fastrom_start


// todo: snes irq, nmi remap



//$00/9532 A7 10       LDA [$10]  [$01:8CDE]   A:8761 X:000E Y:0001 D:1E00 DB:00 S:1FF6 P:eNvmxdIzc HC:0264 VC:259 FC:59 I:00
//
//$00/9534 29 FF 00    AND #$00FF              A:1103 X:000E Y:0001 D:1E00 DB:00 S:1FF6 P:envmxdIzc HC:0352 VC:259 FC:59 I:00

// snes $9534 = file $1532
org $9534
jsr fastrom_code1



// snes 80e020 = snes 00e020 = file 6020
org $80e020

fastrom_start:
// snes native mode
clc
xce

sep #$20
lda.b #$01
sta $420d

// 00xxxx ==> 808001
jml $808001



fastrom_code1:
and.w #$00ff

cmp.w #$0040
bcs fastrom_code1_done

// 24-bit ptr table code jumps  (00-3F ==> 80-BF)
ora.w #$0080

fastrom_code1_done:
rts


And patch to convert FastRom banks (code analysis).
https://www.sendspace.com/file/60krtf

Although I found a bug with how toll handles plb codes but there weren't many in this game. So I think it was okay - have to recheck.

Turns out I had Lunar Address; I just forgot about it  :D
So I've got a few questions. First, which program are you editing that in? (Admittedly I've been going by hand, but most of my changes up til now have just been data tweaks.) Second, what does that patch do? I'm a little confused as to if I still need to write those redirects. IPS files don't really explain what they're changing.

Third, let me see if I got this right.
Code: [Select]
Initial detour for FastROM:
7ffc (Reset vector): 01 80 -> 90 F9

At F990:
A9 01
8D 0D 42
5C 01 80 80

And then I have to redirect these 4 too?
7fea (Native mode NMI): 35 83
7fee (Native mode IRQ): 4E 81
7ffa (Emulation mode NMI): FF FF
7ffe (Emulation mode IRQ): 00 00
Title: Re: Arcana - Seal of Rimsala! (SNES)
Post by: rainponcho on July 23, 2017, 12:49:11 pm
xkas-plus
https://github.com/devinacker/xkas-plus/releases


Ips patch changes game's 24-bit JSL, JML, LDA, ORA, STA, (lala) opcodes to fastrom banks. And some PEA / PLB ones. You still need redirects, fastrom 420d, etc.

bonus asm code: game hides some 24-bit ptrs as data. So I found the routine and fastrom edit on-the-fly.


These 2 need remapping to $80 fastrom.
7fea (Native mode NMI): 35 83
7fee (Native mode IRQ): 4E 81

A simple JML $808335, JML $80814E redirect will work.


At F990... I guess technically we have no idea (?) what startup snes settings are. So we need to
1. enter native snes mode: clc - xce
(we could be in native or emulation mode??)

2. set 8-bit accumulator mode: sep #$20
(could be 16-bit A register)

3. write $01 to $420d
(slowrom -> fastrom)

4. jml to normal start code but in $80 bank
(slow bank -> fast bank)


I only got ~3 frames faster per walking step. But it's "free" and easy. :)

You'd have to optimize down the slow loops to get more frames.
Title: Re: Arcana - Seal of Rimsala! (SNES)
Post by: TimeSpaceMage on July 23, 2017, 02:07:59 pm
Okay, so that's:
Code: [Select]
F990:
18 (clc)
FB (xce)
E2 20 (sep #$20)
A9 01
8D 0D 42
5C 01 80 80

7fea: A0 F9
f9a0: 5C 35 83 80

7FEE: A4 F9
f9a4: 5C 4E 81 80

Wait, am I missing something with xkas? I see where I can use it on the command line to convert .asm to .ips, but I was expecting some sort of editor. Do I just write the .asm file in a text editor?

EDIT: Okay I put the code in, and the reset vector took it to 00/F990... which is still FF's, so it was actually sent to file position $7990. I thought that was part of SRAM? :huh: No, I think I get it; the snes address $7990 would be SRAM or w/e, but the file positions $0000-$7FFF are bank $00 and snes addresses $8001-$FFFF.

EDIT2: Okay it doesn't crash Snes9x any more  :laugh: The startup stats say Mode: 20 though. Hang on...
Title: Re: Arcana - Seal of Rimsala! (SNES)
Post by: KingMike on July 23, 2017, 02:53:19 pm
You write the code as a text file but did you format it correctly?

First line you need lorom/hirom to tell it the format.

Then you would format the address as something like

Code: [Select]
org $80F990
NewBootCode:
and then your code. To fix the reset vector.

Code: [Select]
org $80FFEC
 .dw NewBootCode
At least, I think $FFEC is the Native Mode Reset vector (the start point of the code) and this should write the address of your new start code.
(.dw is the started instruction to insert a "word", a 2-byte value. I can't recall if xkas support that but it should. Maybe it was "dw")

If you didn't correctly define the address to insert your code in your ASM file, it might have defaulted to address 0 in the ROM, possibly corrupting it. You should probably double-check that.
Title: Re: Arcana - Seal of Rimsala! (SNES)
Post by: TimeSpaceMage on July 23, 2017, 03:29:51 pm
Code: [Select]
This one's a pretty big offender.
$80/9B0E DC 49 10    JML [$1049][$00:A105]

And this is where the bank for $1049 is stored, so I guess the trick is getting it to store 80's instead?  o.0
$80/9537 8D 4B 10    STA $104B  [$00:104B]   A:0007
$80/9000 8D 4B 10    STA $104B  [$00:104B]   A:0405

Also found this one.
$03/A363 22 47 9C 00 JSL $009C47[$00:9C47]
Title: Re: Arcana - Seal of Rimsala! (SNES)
Post by: rainponcho on July 23, 2017, 04:56:16 pm
I'd say it depends how much time game spends running those routines. If it hits it a lot, then yeah.. you'll want to manually "run-time" optimize them (00:9532) -- it'd take a long time to dissect each bank ptr correctly through disassembly (data storage).

You'll probably find lots of 24-bit ptrs that I missed, because I never came close to triggering them.
[Bwa ha ha!]



If you keep trace logging, you can run it in this tool:
https://www.sendspace.com/file/9z7g4g

Make sure to backup your rom first. Rename it to 'rom'. Rename your geiger tracelog to 'log'. Run exe. It'll parse it and turn things into fastrom banks.

Be careful about it corrupting your own asm hacks if you keep making (changing) them lots of times. Have to be organized. So I'm not officially releasing it or anything. And turned off PEA - PLB detection since there's situations that mess up.



I'll locate some loop offenders and optimize them first. See what I can get before mentioning them here -- have some ideas to test on them. :)

But I'm going to back off with explanations (since clearly I did a lousy job at it) and let KingMike help you understanding technical problems.


edit: Doesn't look like FastRom will help much. So maybe no point in continuing further this way. I guess there's just too much raster math which is taking the brunt of the slowdown.

Which maybe is why FastRom conversions aren't that popular to fix slow games.

You could always work on your other todo items. Sorry, guess another game that's defeated me again.


edit2:
Out of curiosity, tried some more. There's a routine that inits the drawing data. Although it uses mvn, dma speeds it up another 2 frames. So 23 -> 20 (fastrom) -> 18 (dma init).

I'll keep poking at it then and upload optimized asm file w/ full ips patch if I can get some more time cut.
Title: Re: Arcana - Seal of Rimsala! (SNES)
Post by: Time/SpaceMage on July 23, 2017, 07:03:52 pm
(Yeah I'm just not gonna post on mobile any more)
Phantom edit to see if it's still doing that.
Title: Re: Arcana - Seal of Rimsala! (SNES)
Post by: TimeSpaceMage on July 24, 2017, 12:03:24 am
I'd say it depends how much time game spends running those routines. If it hits it a lot, then yeah.. you'll want to manually "run-time" optimize them (00:9532) -- it'd take a long time to dissect each bank ptr correctly through disassembly (data storage).

What do you mean by 00:9532 and data storage?

Quote
You'll probably find lots of 24-bit ptrs that I missed, because I never came close to triggering them.
[Bwa ha ha!]
I just walked around hitting Step Into to see if the current instruction was in a SlowROM bank :3 Those instructions were from leaving town/Balnea Temple.


Quote
If you keep trace logging, you can run it in this tool:
https://www.sendspace.com/file/9z7g4g

Make sure to backup your rom first. Rename it to 'rom'. Rename your geiger tracelog to 'log'. Run exe. It'll parse it and turn things into fastrom banks.

Be careful about it corrupting your own asm hacks if you keep making (changing) them lots of times. Have to be organized. So I'm not officially releasing it or anything. And turned off PEA - PLB detection since there's situations that mess up.

I'm pretty good at keeping track of them. ;) Every version gets backed up in my Backup folder, and my data edits have the byte changes written to a change log for reference. My work, references and tools are all on my Google Drive too in case of hard drive failure. I've been around long enough to know better than to take chances with my projects!
Title: Re: Arcana - Seal of Rimsala! (SNES)
Post by: rainponcho on July 24, 2017, 09:17:06 pm
This is nearly most I could torture engine. If you generic optimized every single possible thing, maybe you could squeeze another frame.
https://www.sendspace.com/file/kstnbk


Full fastrom ips tester can be applied to vanilla rom. It should give some walking boost (~7-8 frames or ~33%).



The rest of the slowdown comes from running this all the time:
JSR $99FE  [$83:99FE]

That's hard to figure out how to get it better. But that spot would kick it down another 2-3 frames possibly.
Title: Re: Arcana - Seal of Rimsala! (SNES)
Post by: TimeSpaceMage on July 25, 2017, 12:36:05 am
Oh wow, that looks like it was a lot of work!
...

Quote
// average walking stats
//
// balnia   23 ==> 15
// stavery  23 ==> 15
// bintel   19 ==> 12
Holy f- that's plenty fast! Good job  :o

Code: [Select]
org $188044

// random encounter cheat
ldx.w #$00ff
I see that! (http://24.media.tumblr.com/aeb6abc922bfe2e3a78ad7e9c2c31a1e/tumblr_mfyijb0fJ81rkffv3o1_500.gif)  :P I'm using $18 for now, unless the faster speed needs something lower.


Oh, I revisited my old mod discussion on GameFAQs and zombero had this to say:
Quote
zombero    2 years ago   #31
Yeah, I did my own tests back in the day.

From my memory, Str's effect on your damage is basically (1 + (strength/400))*weapon_based_damage. Though it also seems to have some sort of minimum damage that it must add, apparently something like strength/40. Not sure exactly how the implementation works.

I think the weapon-based portion was a subtractive formula with enemy defense, but I don't recall for certain. But weapon is the main driving force in your damage in general.
...I'm starting to wonder if the Defend command does anything at all, though. Maybe I should rename it to "Wait"  ::)
Title: Re: Arcana - Seal of Rimsala! (SNES)
Post by: rainponcho on July 25, 2017, 08:22:42 am
Forgot to remove that cheat - good for exploration though. :)


And I goofed this line:

(ffec ==> ffee)
org $ffee
dw fastrom_irq


And I'm told you don't need this part either:

// lorom, fastrom
org $ffd5
db $30


Otherwise good luck with it!
Title: Re: Arcana - Seal of Rimsala! (SNES)
Post by: zombero on July 25, 2017, 10:34:45 am
Quote
...I'm starting to wonder if the Defend command does anything at all, though. Maybe I should rename it to "Wait"
That I have no idea about.  Defend isn't worth bothering with in most RPGs, and this game was certainly no exception.  :)

Oh, and I'm having the same issue with waiting for replies to be moderated.  Presumably it's probationary period for new posters.
Title: Re: Arcana - Seal of Rimsala! (SNES)
Post by: TimeSpaceMage on July 29, 2017, 06:34:04 pm
rainponcho: You should finalize that patch and submit it! I'd still like to use it in my mod, but there should be a version history to keep track of it better. I'm sure lots of users would like a standalone speed optimization.

zombero: Yeah, I don't get it since neither of us are new users.

So there's a few things I've got in the queue to look at.
-How map progress is stored. (I figure this can lead to understanding how the maps are stored, and therefore editing maps.) So far I've compared 2 SRAMs, with 1 tile difference on the map exploration. I got the following changes:
1376: 0F->01 (-14d)
1378: 1D->15 (-8)
137A: 04->06 (+2)
13F4: 03->01 (-2)
1500: 73->53
By any chance, does this look like a familiar compression to anyone?
Oh, and a bunch of bytes after 1500 were changed into consecutive numbers like the rest of the region, but I'm betting that's something else like a difference in initialization. (My next step is to try a Cheat Search for these values upon taking that step.)

Save files are split up distinctly, btw.
Slot 1: 0100-05FF, 1100-15FF
Slot 2: 0600-0AFF, 1600-1AFF
Slot 3: 0B00-10FF, 1B00-1FFF

So, 2 sets of 500 bytes each. The pairs aren't exact copies, but they're really similar.


-Locating pointer tables. I haven't had luck finding pointers to the dialogue strings, but it's been awhile since I checked and I understand more about banks now.
Title: Re: Arcana - Seal of Rimsala! (SNES)
Post by: KingMike on July 29, 2017, 10:02:35 pm
1 or 2 changes is probably the map data, and the other checksums.
I'd make a couple more test changes to look for patterns.
Does the game keep track of any other variables, such as time played, that could possibly vary uncontrollably?
Title: Re: Arcana - Seal of Rimsala! (SNES)
Post by: Time/SpaceMage on July 29, 2017, 11:57:49 pm
Wow, that's actually what I expected it to be! There is no (known) in-game timer, though there are plenty of variables that advance every frame.
Title: Re: Arcana - Seal of Rimsala! (SNES)
Post by: TimeSpaceMage on July 30, 2017, 07:18:09 pm
OK, I played around with the SRAM viewer in Geiger's Snes9x. Turns out SRAM 0376/0378/037A are where the game saves the last position and compass direction you were at in the dungeon. I was getting $0F/1D/04 from leaving the dungeon normally, but figured this out after a few Return Rings. Side note, the game literally saves your last dungeon position so if we ever work out how Return Rings work, there could be a reverse Return Ring to take you back to where you were. That would be awesome.

(Hid the old research since it's not as relevant now.)
Spoiler:
So this leaves:
3F4: 01->03
500: 5D->73
502: A3->8D
504: E7->E1
512: A1->B7
514: 5F->49
516: 87->81

Filled out 3 spaces instead of 1:
3EC: 01->03
3F0: 00->02

3F4: 01->03 (same)
500: 5D->77
502: A3->89
504: E7->E1 (same)
512: A1->BB
514: 5F->45
516: 87->81 (same)
Maybe 3EC-3F4 have to do with the map tile?

Filled out a lot more:
(Changes from 3 spaces)
3C0: 0000->0300
3C3: 0000->8002
3C7: 0000->8003
3CB: 0000->8001
3D0: 0000->0100
3D3: 00E0->00E3
3D7: 00A0->80A2
3DB: 00B6->80B6
3E3: 0001->8001
500: 77 53 89 AC E1 -> 06 57 FA A8 62
510: 6F 00 BB 07 45 F8 81 -> 6F 00 4A 0B B6 F4 02

...OK I have no idea what the 500's are doing, but they aren't map progress. I walked to the end of the (explored) room and used a Return Ring, and the new save file had completely different 500's. I even got ten changed values from buying another Return Ring, not counting the GP change!


EDIT: Well I worked out the rest of the known data, enough to make a reference page (http://datacrystal.romhacking.net/wiki/Arcana:SRAM_map) on Data Crystal. Dungeon progress seems to be stored in 380-3FF, so that at least narrows things down. It could be in 400-4FF too, but I'd need to fill out a larger area such as the Ice Mine Ice Maze.

EDIT2: Well hello there! I found a pointer table in the ROM for which addresses get an MVN to SRAM. They're in groups of 3 bytes, the "from" address and the # of consecutive bytes to copy. The RAM addresses are now on the SRAM reference page btw.

If anyone would like to help trace the map data, it starts around $1700 in RAM.


August 01, 2017, 05:44:29 pm - (Auto Merged - Double Posts are not allowed before 7 days.)
Gentlemen... BEHOLD!
CORN!!

(http://i.imgur.com/P4wrJnM.png)

Yep, that's Balnea Temple 1F in RAM ;D  Turns out the map isn't compressed... in RAM. Bastard was all the way at the end. Here's the code I followed, tracing the changes to the Dungeon X/Y position (which I call Xpos and Ypos for short):

Code: [Select]
$83/A2FA BF 79 A4 83 LDA $83A479,x[$83:A47B] *Load offset to Xpos (i.e. 01 if you moved east)
$83/A2FE 18          CLC
$83/A2FF 6D F7 16    ADC $16F7  [$80:16F7] *Add A to Xpos
$83/A302 85 22       STA $22    [$00:1E22]
$83/A304 BF 81 A4 83 LDA $83A481,x[$83:A483] *Load offset to Ypos (i.e. 01 if you moved south)
$83/A308 18          CLC                   
$83/A309 6D F9 16    ADC $16F9  [$80:16F9] *Add A to Ypos
$83/A30C 85 24       STA $24    [$00:1E24] 
$83/A30E A6 22       LDX $22    [$00:1E22] 
$83/A310 20 57 A4    JSR $A457  [$83:A457] 

$83/A457 C9 20 00    CMP #$0020             
$83/A45A B0 19       BCS $19    [$A475]     *Verify Xpos < $20
$83/A45C 09 00 20    ORA #$2000             <-This threw me at first, but it's storing #$20 to $4203
$83/A45F 8D 02 42    STA $4202  [$80:4202]  <-and so multiplying Ypos * $20.
$83/A462 E0 20 00    CPX #$0020             
$83/A465 B0 0E       BCS $0E    [$A475]     *Verify Ypos < $20
$83/A467 8A          TXA                    *Move Xpos to A
$83/A468 18          CLC                   
$83/A469 6D 16 42    ADC $4216  [$80:4216]  *Add: Xpos + Ypos*$20
$83/A46C AA          TAX                    *Make this an offset
$83/A46D BF 00 FC 7F LDA $7FFC00,x[$7F:FFB0]*Load from a table with $20 bytes per line
$83/A471 29 FF 00    AND #$00FF             
$83/A474 60          RTS                   

So seeing that LDA and staring at the table, I typed out 2 rows per line and it was as plain as day!
80 = chest
90 = exit
40 = stairs up
70 = boss
I presume 30 are no-encounter tiles, and the difference of 10-12 is unclear. More research is needed  :D
Title: Re: Arcana - Seal of Rimsala! (SNES)
Post by: Time/SpaceMage on August 01, 2017, 09:10:58 pm
Ok, I found Balnea 1F in ROM; it starts at x9EBF7 ($93/EBF7). The maps are compressed with Run Length Encoding. Here's the format as I have observed so far:

00 40 = Repeat 40 once
24 30 = Repeat 30 five times
23 12 = Repeat 12 four times
2E 00 = Repeat 00 F (E+1) times
41 80 00 = Repeat "80 00" twice
(There's a 60 code too, but I haven't seen an example yet.)
05 = WYSIWYG

If the control code is negative (80+) it's a MVN.
83 00 52 = MVN 4 bytes from $xx52.
9F 00 57 = MVN 20 bytes from $xx57.

Code: [Select]
You can follow along with the above image; here's the first line.
2E 00
00 40
36 00
41 80 00
24 30
23 12
00 00
22 10

So... anyone know a good tool for de/recompressing RLE?  :angel: (I mean, I could write one but if there's already one, great!)
Title: Re: Arcana - Seal of Rimsala! (SNES)
Post by: rainponcho on August 02, 2017, 12:33:34 pm
Haven't forgotten about uploading a standalone fastrom patch for vanilla. After optimizing Super Ghouls 'n Ghosts to playable levels, learned some new tricks.


Moving through Stavery is a little faster now. To me, almost bearable walking speed now when holding motion button down.
Title: Re: Arcana - Seal of Rimsala! (SNES)
Post by: TimeSpaceMage on August 03, 2017, 08:09:30 pm
Bug report! So something in that FastROM patch is breaking the event at the end of Chapter 1. The character graphics are corrupted, and after the Paralyze spell the game crashes.
Title: Re: Arcana - Seal of Rimsala! (SNES)
Post by: rainponcho on August 03, 2017, 10:47:17 pm
Yeah, happens in the new FastROM patch too (one in queue). I'll try sorting it out. Anyone I've worked with can tell you how buggy my stuff can be. :)
(Wish I had more time to actually play these games instead of just panic speedrun testing all these hacks I make)



Meantime, made a patch that will multi-level up and rollover exp gains.
https://www.sendspace.com/file/nqij5l
(this was not trivial at all so I pitched in here)


Game uses a scripting language that made this more difficult than imagined.

$80/902B = where it reads scripting code
07 = run asm code (24-bit addr)
0c = jump if false (16-bit addr)
1b = jsr (16-bit addr)
1c = ret


ex.
01:90aa = 07  07b234  ==> check exp asm
01:90ae = 0b  9129    ==> no gain level (jmp)

Eventually found where it does the level up routine and extended it via scripting.


edit: HAL actually uses the DMA for that cutscene. Which collides with some speedup tricks. Have to rework it then. :|



edit2: New fastrom patch in queue. Do not use hdma 2,3,4,7.
https://www.sendspace.com/file/5a63vs

Played up to Chapter 3 ending okay.



edit3:
Some info about how battle damage works.

Code: [Select]
battle


$80/C0B9 C5 00       CMP $00    [$00:1E00]   A:0067 X:0094 Y:0008 D:1E00 DB:80 S:1FF0 P:envmxdIzC HC:0278 VC:093 FC:26 I:00
$80/C0BB 90 04       BCC $04    [$C0C1]      A:0067 X:0094 Y:0008 D:1E00 DB:80 S:1FF0 P:eNvmxdIzc HC:0312 VC:093 FC:26 I:00
$80/C0C1 9C 25 11    STZ $1125  [$80:1125]   A:0067 X:0094 Y:0008 D:1E00 DB:80 S:1FF0 P:eNvmxdIzc HC:0336 VC:093 FC:26 I:00
$80/C0C4 C5 02       CMP $02    [$00:1E02]   A:0067 X:0094 Y:0008 D:1E00 DB:80 S:1FF0 P:eNvmxdIzc HC:0376 VC:093 FC:26 I:00
$80/C0C6 B0 03       BCS $03    [$C0CB]      A:0067 X:0094 Y:0008 D:1E00 DB:80 S:1FF0 P:envmxdIzC HC:0410 VC:093 FC:26 I:00



get max damage
$80/C0CB AE 21 11    LDX $1121  [$80:1121]   A:0067 X:0094 Y:0008 D:1E00 DB:80 S:1FF0 P:envmxdIzC HC:0434 VC:093 FC:26 I:00
$80/C0CE 22 CA C4 80 JSL $80C4CA[$80:C4CA]   A:0067 X:0008 Y:0008 D:1E00 DB:80 S:1FF0 P:envmxdIzC HC:0474 VC:093 FC:26 I:00
$80/C0D2 85 00       STA $00    [$00:1E00]   A:0041 X:0000 Y:0008 D:1E00 DB:80 S:1FF0 P:envmxdIzc HC:0698 VC:097 FC:26 I:00




player defense value
$80/C0D4 AE 23 11    LDX $1123  [$80:1123]   A:0041 X:0000 Y:0008 D:1E00 DB:80 S:1FF0 P:envmxdIzc HC:0732 VC:097 FC:26 I:00
$80/C0D7 22 26 C5 80 JSL $80C526[$80:C526]   A:0041 X:0000 Y:0008 D:1E00 DB:80 S:1FF0 P:envmxdIZc HC:0772 VC:097 FC:26 I:00
$80/C0DB 85 02       STA $02    [$00:1E02]   A:0041 X:0033 Y:0000 D:1E00 DB:80 S:1FF0 P:envmxdIzc HC:0704 VC:100 FC:39 I:00


======================================


$80/C526 86 06       STX $06    [$00:1E06]   A:0041 X:0000 Y:0008 D:1E00 DB:80 S:1FED P:envmxdIZc HC:0836 VC:097 FC:39 I:00
$80/C528 A4 06       LDY $06    [$00:1E06]   A:0041 X:0000 Y:0008 D:1E00 DB:80 S:1FED P:envmxdIZc HC:0876 VC:097 FC:39 I:00
$80/C52A A2 00 00    LDX #$0000              A:0041 X:0000 Y:0000 D:1E00 DB:80 S:1FED P:envmxdIZc HC:0916 VC:097 FC:39 I:00
$80/C52D 20 81 C7    JSR $C781  [$80:C781]   A:0041 X:0000 Y:0000 D:1E00 DB:80 S:1FED P:envmxdIZc HC:0946 VC:097 FC:39 I:00
$80/C530 A2 66 00    LDX #$0066              A:0028 X:0056 Y:0000 D:1E00 DB:80 S:1FED P:envmxdIzc HC:0124 VC:098 FC:39 I:00
$80/C533 20 8B C8    JSR $C88B  [$80:C88B]   A:0028 X:0066 Y:0000 D:1E00 DB:80 S:1FED P:envmxdIzc HC:0160 VC:098 FC:39 I:00
$80/C536 29 00 FF    AND #$FF00              A:0FF0 X:0066 Y:0000 D:1E00 DB:80 S:1FED P:envmxdIzc HC:0588 VC:098 FC:39 I:00
$80/C539 EB          XBA                     A:0F00 X:0066 Y:0000 D:1E00 DB:80 S:1FED P:envmxdIzc HC:0624 VC:098 FC:39 I:00
$80/C53A 85 08       STA $08    [$00:1E08]   A:000F X:0066 Y:0000 D:1E00 DB:80 S:1FED P:envmxdIzc HC:0660 VC:098 FC:39 I:00
$80/C53C A4 06       LDY $06    [$00:1E06]   A:000F X:0066 Y:0000 D:1E00 DB:80 S:1FED P:envmxdIzc HC:0706 VC:098 FC:39 I:00
$80/C53E A2 00 00    LDX #$0000              A:000F X:0066 Y:0000 D:1E00 DB:80 S:1FED P:envmxdIZc HC:0752 VC:098 FC:39 I:00
$80/C541 20 D1 C7    JSR $C7D1  [$80:C7D1]   A:000F X:0000 Y:0000 D:1E00 DB:80 S:1FED P:envmxdIZc HC:0788 VC:098 FC:39 I:00
$80/C544 A2 33 00    LDX #$0033              A:0028 X:00A4 Y:0000 D:1E00 DB:80 S:1FED P:envmxdIzc HC:1330 VC:098 FC:39 I:00
$80/C547 20 8B C8    JSR $C88B  [$80:C88B]   A:0028 X:0033 Y:0000 D:1E00 DB:80 S:1FED P:envmxdIzc HC:1366 VC:098 FC:39 I:00
$80/C54A 29 00 FF    AND #$FF00              A:07F8 X:0033 Y:0000 D:1E00 DB:80 S:1FED P:envmxdIzc HC:0390 VC:099 FC:39 I:00
$80/C54D EB          XBA                     A:0700 X:0033 Y:0000 D:1E00 DB:80 S:1FED P:envmxdIzc HC:0426 VC:099 FC:39 I:00
$80/C54E 18          CLC                     A:0007 X:0033 Y:0000 D:1E00 DB:80 S:1FED P:envmxdIzc HC:0462 VC:099 FC:39 I:00
$80/C54F 65 08       ADC $08    [$00:1E08]   A:0007 X:0033 Y:0000 D:1E00 DB:80 S:1FED P:envmxdIzc HC:0492 VC:099 FC:39 I:00
$80/C551 85 08       STA $08    [$00:1E08]   A:0016 X:0033 Y:0000 D:1E00 DB:80 S:1FED P:envmxdIzc HC:0538 VC:099 FC:39 I:00
$80/C553 A6 06       LDX $06    [$00:1E06]   A:0016 X:0033 Y:0000 D:1E00 DB:80 S:1FED P:envmxdIzc HC:0624 VC:099 FC:39 I:00
$80/C555 20 6A C6    JSR $C66A  [$80:C66A]   A:0016 X:0000 Y:0000 D:1E00 DB:80 S:1FED P:envmxdIZc HC:0682 VC:099 FC:39 I:00
$80/C558 A2 33 00    LDX #$0033              A:00DC X:00DF Y:0000 D:1E00 DB:80 S:1FED P:envmxdIzc HC:0032 VC:100 FC:39 I:00
$80/C55B 20 8B C8    JSR $C88B  [$80:C88B]   A:00DC X:0033 Y:0000 D:1E00 DB:80 S:1FED P:envmxdIzc HC:0068 VC:100 FC:39 I:00
$80/C55E 29 00 FF    AND #$FF00              A:2BD4 X:0033 Y:0000 D:1E00 DB:80 S:1FED P:envmxdIzc HC:0456 VC:100 FC:39 I:00
$80/C561 EB          XBA                     A:2B00 X:0033 Y:0000 D:1E00 DB:80 S:1FED P:envmxdIzc HC:0492 VC:100 FC:39 I:00
$80/C562 18          CLC                     A:002B X:0033 Y:0000 D:1E00 DB:80 S:1FED P:envmxdIzc HC:0528 VC:100 FC:39 I:00
$80/C563 65 08       ADC $08    [$00:1E08]   A:002B X:0033 Y:0000 D:1E00 DB:80 S:1FED P:envmxdIzc HC:0598 VC:100 FC:39 I:00
$80/C565 6B          RTL                     A:0041 X:0033 Y:0000 D:1E00 DB:80 S:1FED P:envmxdIzc HC:0644 VC:100 FC:39 I:00


=========================================



$80/C0DD AE 23 11    LDX $1123  [$80:1123]   A:0041 X:0033 Y:0000 D:1E00 DB:80 S:1FF0 P:envmxdIzc HC:0750 VC:100 FC:39 I:00
$80/C0E0 A0 0C 00    LDY #$000C              A:0041 X:0000 Y:0000 D:1E00 DB:80 S:1FF0 P:envmxdIZc HC:0802 VC:100 FC:39 I:00
$80/C0E3 22 85 C5 80 JSL $80C585[$80:C585]   A:0041 X:0000 Y:000C D:1E00 DB:80 S:1FF0 P:envmxdIzc HC:0838 VC:100 FC:39 I:00


base defense -- rooks = $19
$80/C0E7 BF 4F C0 80 LDA $80C04F,x[$80:C04F] A:0000 X:0000 Y:000C D:1E00 DB:80 S:1FF0 P:envmxdIZc HC:0024 VC:101 FC:39 I:00
$80/C0EB A2 33 00    LDX #$0033              A:0080 X:0000 Y:000C D:1E00 DB:80 S:1FF0 P:envmxdIzc HC:0078 VC:101 FC:39 I:00
$80/C0EE 20 8B C8    JSR $C88B  [$80:C88B]   A:0080 X:0033 Y:000C D:1E00 DB:80 S:1FF0 P:envmxdIzc HC:0114 VC:101 FC:39 I:00
$80/C0F1 29 00 FF    AND #$FF00              A:1980 X:0033 Y:000C D:1E00 DB:80 S:1FF0 P:envmxdIzc HC:0502 VC:101 FC:39 I:00
$80/C0F4 EB          XBA                     A:1900 X:0033 Y:000C D:1E00 DB:80 S:1FF0 P:envmxdIzc HC:0102 VC:101 FC:26 I:00


+ armor bonus + level bonus
$80/C0F5 18          CLC                     A:0019 X:0033 Y:000C D:1E00 DB:80 S:1FF0 P:envmxdIzc HC:0126 VC:101 FC:26 I:00
$80/C0F6 65 02       ADC $02    [$00:1E02]   A:0019 X:0033 Y:000C D:1E00 DB:80 S:1FF0 P:envmxdIzc HC:0144 VC:101 FC:26 I:00
$80/C0F8 85 02       STA $02    [$00:1E02]   A:005A X:0033 Y:000C D:1E00 DB:80 S:1FF0 P:envmxdIzc HC:0178 VC:101 FC:26 I:00


$80/C0FA A9 FF 00    LDA #$00FF              A:005A X:0033 Y:000C D:1E00 DB:80 S:1FF0 P:envmxdIzc HC:0212 VC:101 FC:26 I:00
$80/C0FD 38          SEC                     A:00FF X:0033 Y:000C D:1E00 DB:80 S:1FF0 P:envmxdIzc HC:0236 VC:101 FC:26 I:00
$80/C0FE E5 02       SBC $02    [$00:1E02]   A:00FF X:0033 Y:000C D:1E00 DB:80 S:1FF0 P:envmxdIzC HC:0254 VC:101 FC:26 I:00


~~ damage % amount -- $a5 = 0.64453125 x full damage
$80/C100 AA          TAX                     A:00A5 X:0033 Y:000C D:1E00 DB:80 S:1FF0 P:envmxdIzC HC:0288 VC:101 FC:26 I:00


get full damage amount??
$80/C101 A5 00       LDA $00    [$00:1E00]   A:00A5 X:00A5 Y:000C D:1E00 DB:80 S:1FF0 P:envmxdIzC HC:0306 VC:101 FC:26 I:00
$80/C103 20 A1 C8    JSR $C8A1  [$80:C8A1]   A:0041 X:00A5 Y:000C D:1E00 DB:80 S:1FF0 P:envmxdIzC HC:0340 VC:101 FC:26 I:00



======================================================

$80/C8A1 85 22       STA $22    [$00:1E22]   A:0050 X:00D1 Y:0008 D:1E00 DB:80 S:1FEB P:envmxdIzC HC:0616 VC:096 FC:26 I:00
$80/C8A3 20 8B C8    JSR $C88B  [$80:C88B]   A:0050 X:00D1 Y:0008 D:1E00 DB:80 S:1FEB P:envmxdIzC HC:0650 VC:096 FC:26 I:00


$80/C8A6 85 24       STA $24    [$00:1E24]   A:4150 X:00D1 Y:0008 D:1E00 DB:80 S:1FEB P:envmxdIzC HC:1026 VC:096 FC:26 I:00
$80/C8A8 A5 22       LDA $22    [$00:1E22]   A:4150 X:00D1 Y:0008 D:1E00 DB:80 S:1FEB P:envmxdIzC HC:1060 VC:096 FC:26 I:00
$80/C8AA EB          XBA                     A:0050 X:00D1 Y:0008 D:1E00 DB:80 S:1FEB P:envmxdIzC HC:1094 VC:096 FC:26 I:00
$80/C8AB 20 8B C8    JSR $C88B  [$80:C88B]   A:5000 X:00D1 Y:0008 D:1E00 DB:80 S:1FEB P:envmxdIZC HC:1160 VC:096 FC:26 I:00


$80/C8AE 85 22       STA $22    [$00:1E22]   A:0000 X:00D1 Y:0008 D:1E00 DB:80 S:1FEB P:envmxdIZC HC:0172 VC:097 FC:26 I:00
$80/C8B0 29 00 FF    AND #$FF00              A:0000 X:00D1 Y:0008 D:1E00 DB:80 S:1FEB P:envmxdIZC HC:0206 VC:097 FC:26 I:00
$80/C8B3 EB          XBA                     A:0000 X:00D1 Y:0008 D:1E00 DB:80 S:1FEB P:envmxdIZC HC:0230 VC:097 FC:26 I:00
$80/C8B4 AA          TAX                     A:0000 X:00D1 Y:0008 D:1E00 DB:80 S:1FEB P:envmxdIZC HC:0254 VC:097 FC:26 I:00
$80/C8B5 A5 22       LDA $22    [$00:1E22]   A:0000 X:0000 Y:0008 D:1E00 DB:80 S:1FEB P:envmxdIZC HC:0272 VC:097 FC:26 I:00
$80/C8B7 29 FF 00    AND #$00FF              A:0000 X:0000 Y:0008 D:1E00 DB:80 S:1FEB P:envmxdIZC HC:0306 VC:097 FC:26 I:00
$80/C8BA EB          XBA                     A:0000 X:0000 Y:0008 D:1E00 DB:80 S:1FEB P:envmxdIZC HC:0330 VC:097 FC:26 I:00
$80/C8BB 18          CLC                     A:0000 X:0000 Y:0008 D:1E00 DB:80 S:1FEB P:envmxdIZC HC:0354 VC:097 FC:26 I:00
$80/C8BC 65 24       ADC $24    [$00:1E24]   A:0000 X:0000 Y:0008 D:1E00 DB:80 S:1FEB P:envmxdIZc HC:0372 VC:097 FC:26 I:00
$80/C8BE 90 01       BCC $01    [$C8C1]      A:4150 X:0000 Y:0008 D:1E00 DB:80 S:1FEB P:envmxdIzc HC:0406 VC:097 FC:26 I:00
$80/C8C1 60          RTS                     A:4150 X:0000 Y:0008 D:1E00 DB:80 S:1FEB P:envmxdIzc HC:0430 VC:097 FC:26 I:00

======================================================


final damage
$80/C106 29 00 FF    AND #$FF00              A:29E5 X:0000 Y:000C D:1E00 DB:80 S:1FF0 P:envmxdIzc HC:0286 VC:102 FC:26 I:00
$80/C109 85 00       STA $00    [$00:1E00]   A:2900 X:0000 Y:000C D:1E00 DB:80 S:1FF0 P:envmxdIzc HC:0310 VC:102 FC:26 I:00



$80/C10B 8A          TXA                     A:2900 X:0000 Y:000C D:1E00 DB:80 S:1FF0 P:envmxdIzc HC:0344 VC:102 FC:26 I:00
$80/C10C 05 00       ORA $00    [$00:1E00]   A:0000 X:0000 Y:000C D:1E00 DB:80 S:1FF0 P:envmxdIZc HC:0362 VC:102 FC:26 I:00
$80/C10E EB          XBA                     A:2900 X:0000 Y:000C D:1E00 DB:80 S:1FF0 P:envmxdIzc HC:0396 VC:102 FC:26 I:00
$80/C10F 85 00       STA $00    [$00:1E00]   A:0029 X:0000 Y:000C D:1E00 DB:80 S:1FF0 P:envmxdIzc HC:0420 VC:102 FC:26 I:00





$80/C111 AE 21 11    LDX $1121  [$80:1121]   A:0029 X:0000 Y:000C D:1E00 DB:80 S:1FF0 P:envmxdIzc HC:0454 VC:102 FC:26 I:00
$80/C114 AC 23 11    LDY $1123  [$80:1123]   A:0029 X:0008 Y:000C D:1E00 DB:80 S:1FF0 P:envmxdIzc HC:0494 VC:102 FC:26 I:00
$80/C117 20 B1 C5    JSR $C5B1  [$80:C5B1]   A:0029 X:0008 Y:0000 D:1E00 DB:80 S:1FF0 P:envmxdIZc HC:0534 VC:102 FC:26 I:00


$80/C11A AA          TAX                     A:0002 X:0005 Y:0003 D:1E00 DB:80 S:1FF0 P:envmxdIzc HC:0538 VC:113 FC:26 I:00
$80/C11B BF 76 C1 80 LDA $80C176,x[$80:C178] A:0002 X:0002 Y:0003 D:1E00 DB:80 S:1FF0 P:envmxdIzc HC:0596 VC:113 FC:26 I:00
$80/C11F A6 00       LDX $00    [$00:1E00]   A:0100 X:0002 Y:0003 D:1E00 DB:80 S:1FF0 P:envmxdIzc HC:0638 VC:113 FC:26 I:00
$80/C121 22 39 8A 80 JSL $808A39[$80:8A39]   A:0100 X:0029 Y:0003 D:1E00 DB:80 S:1FF0 P:envmxdIzc HC:0672 VC:113 FC:26 I:00


$80/C125 A5 01       LDA $01    [$00:1E01]   A:0000 X:0000 Y:0003 D:1E00 DB:80 S:1FF0 P:envmxdIZc HC:0616 VC:114 FC:26 I:00
$80/C127 85 00       STA $00    [$00:1E00]   A:0029 X:0000 Y:0003 D:1E00 DB:80 S:1FF0 P:envmxdIzc HC:0650 VC:114 FC:26 I:00
$80/C129 AE 21 11    LDX $1121  [$80:1121]   A:0029 X:0000 Y:0003 D:1E00 DB:80 S:1FF0 P:envmxdIzc HC:0684 VC:114 FC:26 I:00
$80/C12C AC 23 11    LDY $1123  [$80:1123]   A:0029 X:0008 Y:0003 D:1E00 DB:80 S:1FF0 P:envmxdIzc HC:0724 VC:114 FC:26 I:00
$80/C12F 20 0C C3    JSR $C30C  [$80:C30C]   A:0029 X:0008 Y:0000 D:1E00 DB:80 S:1FF0 P:envmxdIZc HC:0764 VC:114 FC:26 I:00

From what I get so far, Rooks has a base armor value @ 80C04F,x table. Add level buffs + armor. Gives us full defense.

255 - full_defense = % attack.


Admittedly it does more math down the line around $80/C156 with that $29 value * $00C0 ==> $1E (30 points). It then adds another 4 points @ $80/C2CB = final 34 damage Rooks receives.




Efrite hits Rooks

$80/C0DB values ==> final damage

$00 ==> 44 points
$41 ==> 34 points
$7f ==> 21 points
$80 ==> 20 points
$c0 ==>  6 points
$e0 ==>  1 points
$e6 ==>  1 points

$e7 ==> 52 points
$f0 ==> 47 points
$ff ==> 41 points


Notes are messy but this is what I've got. You have to play around with all the values at various spots to see how final damage gets tweaked around. Then it's a bit more clear how this thing works. ^^
Title: Re: Arcana - Seal of Rimsala! (SNES)
Post by: TimeSpaceMage on August 06, 2017, 01:31:21 pm
Meantime, made a patch that will multi-level up and rollover exp gains.
https://www.sendspace.com/file/nqij5l
(this was not trivial at all so I pitched in here)


Game uses a scripting language that made this more difficult than imagined.

$80/902B = where it reads scripting code
07 = run asm code (24-bit addr)
0c = jump if false (16-bit addr)
1b = jsr (16-bit addr)
1c = ret


ex.
01:90aa = 07  07b234  ==> check exp asm
01:90ae = 0b  9129    ==> no gain level (jmp)

Eventually found where it does the level up routine and extended it via scripting.

Omigosh I can't wait to try that out  8)
..So that's what those bytes do! How in the world did you figure them out? (Still not sure I understand that second example, though.)

I figured out some codes too, from playing with the text display. Here's most of my notes:
Code: [Select]
00 Text delimiter (End of text/Stop reading)
08 XX Tabs to a position XX
0D Newline
7F Wait for A press

Exploring
98 15 Card used (98 is the byte offset, so using 99 15 would use 1 of "ind Card")
AF 15 Object name ("Dagger" acquired, Rooks has mastered "Unpetrify")
DB 16 Number amount ("300" GP acquired, "200" HP restored)
01 6B 33 MP cost (in spell descriptions)

Battles
06 0E 11 06 deals with text formatting. This should change the font color.
10 81 15 Character name (All of Rooks's power has been increased)
01 E7 16 Level up HP bonus
01 EB 16 Level up MP bonus
01 DD 16 Level up Str bonus
01 DF 16 Level up End bonus
01 E1 16 Level up Int bonus
01 E3 16 Level up Agi bonus

Dialogue
10 A5 FA 0C Pause then clear text; clear face (character finished talking)
10 1E FA 0C Pause then clear text; keep face (character still talking)
10 1B FA 0C Pause then newline; keep face (character still talking; same page)

10 (F5 F7) 0C Ariel speaking
10 (E3 F7) 0C Rooks speaking (no pic)
10 (0D F8) 0C Teefa speaking

For instance, starting a dialogue with one of these 3 codes will show their face and precede the text with
their name automatically. Some characters seem to have multiple commands available, such as to say their line
without their face appearing. However, calling a character whose graphics aren't in memory will cause graphics
glitches. There also seem to be codes for calling special events (such as a character appearing or moving on
the screen, the flash when Rooks gets stunned etc). This needs more research, but I'm thinking the actual event
is elsewhere in the code. It would be neat if we could control these for custom events or different character appearances.

A lot of text formatting starts with 06 or 10, and there's codes for text speed and vertical/horizontal spacing between letters too.
(For text speed, notice how sometimes text will display one line at a time or a page at a time.)

Quote
Some info about how battle damage works.
<cut for message length>

Efrite hits Rooks

$80/C0DB values ==> final damage

$00 ==> 44 points
$41 ==> 34 points
$7f ==> 21 points
$80 ==> 20 points
$c0 ==>  6 points
$e0 ==>  1 points
$e6 ==>  1 points

$e7 ==> 52 points
$f0 ==> 47 points
$ff ==> 41 points


Notes are messy but this is what I've got. You have to play around with all the values at various spots to see how final damage gets tweaked around. Then it's a bit more clear how this thing works. ^^

Wow, this is gonna take me a long time to analyze  :o
So your defense bonuses lower your damage by a percentage? That could make balancing efforts easier, considering monster attack power is harder to change. (According to zombero, monster attack power is a pointer including the damage animation, so swapping values would give monsters each others' animations as well. Giving a Slime Rimsala's attack gives it double swords.)

Maybe raising armor defense bonuses would make armor more useful. Come to think of it, figuring out those monster attack pointers could help raise their damage without taking it to his extremes of doubling their damage.

Wait, where did this $80/C0DB come from? I didn't see that mentioned elsewhere in your snippets. So many questions! (Going out today for my wife's birthday, but I'll have some time this week to work on things.)
Title: Re: Arcana - Seal of Rimsala! (SNES)
Post by: rainponcho on August 06, 2017, 04:15:22 pm
Tracked back where exp check came from and wondered why it looked like 16-bit, 24-bit data ptrs. Check tracking the script loop and mapped out stuff I wanted.


Code: [Select]
01:9028 = run code 1b. jsr to 907f and continue.

I edited this to run my own code at 81:ff00
-- jsr $907f
-- asm level_loop (rewinds ptr if exp overflow)
-- rts


===>

level up routine
01:907f = ...
...

01:90aa = run code 07. asm code 07:b234. This checks our exp and returns
-- 0 = no level
-- 1 = level up.

01:90ae = run code 0b. If our flag is 0, then jump to (01:)9129.

-- (no jump) 01:90b1 = start elemental upgrade logic
-- (jump) 01:9129 = run code 1c. Exit routine.


Code: [Select]
get max damage??
$80/C0CB AE 21 11    LDX $1121  [$80:1121]   A:0067 X:0094 Y:0008 D:1E00 DB:80 S:1FF0 P:envmxdIzC HC:0434 VC:093 FC:26 I:00
$80/C0CE 22 CA C4 80 JSL $80C4CA[$80:C4CA]   A:0067 X:0008 Y:0008 D:1E00 DB:80 S:1FF0 P:envmxdIzC HC:0474 VC:093 FC:26 I:00
$80/C0D2 85 00       STA $00    [$00:1E00]   A:0041 X:0000 Y:0008 D:1E00 DB:80 S:1FF0 P:envmxdIzc HC:0698 VC:097 FC:26 I:00



player defense bonus
$80/C0D4 AE 23 11    LDX $1123  [$80:1123]   A:0041 X:0000 Y:0008 D:1E00 DB:80 S:1FF0 P:envmxdIzc HC:0732 VC:097 FC:26 I:00
$80/C0D7 22 26 C5 80 JSL $80C526[$80:C526]   A:0041 X:0000 Y:0008 D:1E00 DB:80 S:1FF0 P:envmxdIZc HC:0772 VC:097 FC:26 I:00
$80/C0DB 85 02       STA $02    [$00:1E02]   A:0041 X:0033 Y:0000 D:1E00 DB:80 S:1FF0 P:envmxdIzc HC:0704 VC:100 FC:39 I:00

1 armor = 1/255 less damage. Or maybe 1/256 less damage.

My damage formula notes are fuzzy because I don't quite understand it either. :)
Title: Re: Arcana - Seal of Rimsala! (SNES)
Post by: TimeSpaceMage on August 07, 2017, 10:27:31 pm
I just figured out that JSR $C88B multiplies A*X! Man, this code makes SO much more sense now. Looks like you already knew that, though.

OK, let me see if I'm following so far. I like to have all of my offsets in one place.

Quote
Code: [Select]
battle


$80/C0B9 C5 00       CMP $00    [$00:1E00]   A:0067 X:0094 Y:0008 D:1E00 DB:80 S:1FF0 P:envmxdIzC HC:0278 VC:093 FC:26 I:00
$80/C0BB 90 04       BCC $04    [$C0C1]      A:0067 X:0094 Y:0008 D:1E00 DB:80 S:1FF0 P:eNvmxdIzc HC:0312 VC:093 FC:26 I:00
$80/C0C1 9C 25 11    STZ $1125  [$80:1125]   A:0067 X:0094 Y:0008 D:1E00 DB:80 S:1FF0 P:eNvmxdIzc HC:0336 VC:093 FC:26 I:00
$80/C0C4 C5 02       CMP $02    [$00:1E02]   A:0067 X:0094 Y:0008 D:1E00 DB:80 S:1FF0 P:eNvmxdIzc HC:0376 VC:093 FC:26 I:00
$80/C0C6 B0 03       BCS $03    [$C0CB]      A:0067 X:0094 Y:0008 D:1E00 DB:80 S:1FF0 P:envmxdIzC HC:0410 VC:093 FC:26 I:00



get max damage
$80/C0CB AE 21 11    LDX $1121  [$80:1121]   A:0067 X:0094 Y:0008 D:1E00 DB:80 S:1FF0 P:envmxdIzC HC:0434 VC:093 FC:26 I:00
$80/C0CE 22 CA C4 80 JSL $80C4CA[$80:C4CA]   A:0067 X:0008 Y:0008 D:1E00 DB:80 S:1FF0 P:envmxdIzC HC:0474 VC:093 FC:26 I:00
$80/C0D2 85 00       STA $00    [$00:1E00]   A:0041 X:0000 Y:0008 D:1E00 DB:80 S:1FF0 P:envmxdIzc HC:0698 VC:097 FC:26 I:00




player defense value
$80/C0D4 AE 23 11    LDX $1123  [$80:1123]   A:0041 X:0000 Y:0008 D:1E00 DB:80 S:1FF0 P:envmxdIzc HC:0732 VC:097 FC:26 I:00
$80/C0D7 22 26 C5 80 JSL $80C526[$80:C526]   A:0041 X:0000 Y:0008 D:1E00 DB:80 S:1FF0 P:envmxdIZc HC:0772 VC:097 FC:26 I:00
$80/C0DB 85 02       STA $02    [$00:1E02]   A:0041 X:0033 Y:0000 D:1E00 DB:80 S:1FF0 P:envmxdIzc HC:0704 VC:100 FC:39 I:00


======================================


$80/C526 86 06       STX $06    [$00:1E06]   A:0041 X:0000 Y:0008 D:1E00 DB:80 S:1FED P:envmxdIZc HC:0836 VC:097 FC:39 I:00
$80/C528 A4 06       LDY $06    [$00:1E06]   A:0041 X:0000 Y:0008 D:1E00 DB:80 S:1FED P:envmxdIZc HC:0876 VC:097 FC:39 I:00
$80/C52A A2 00 00    LDX #$0000              A:0041 X:0000 Y:0000 D:1E00 DB:80 S:1FED P:envmxdIZc HC:0916 VC:097 FC:39 I:00
$80/C52D 20 81 C7    JSR $C781  [$80:C781]   A:0041 X:0000 Y:0000 D:1E00 DB:80 S:1FED P:envmxdIZc HC:0946 VC:097 FC:39 I:00
$80/C530 A2 66 00    LDX #$0066              A:0028 X:0056 Y:0000 D:1E00 DB:80 S:1FED P:envmxdIzc HC:0124 VC:098 FC:39 I:00
$80/C533 20 8B C8    JSR $C88B  [$80:C88B]   A:0028 X:0066 Y:0000 D:1E00 DB:80 S:1FED P:envmxdIzc HC:0160 VC:098 FC:39 I:00
$80/C536 29 00 FF    AND #$FF00              A:0FF0 X:0066 Y:0000 D:1E00 DB:80 S:1FED P:envmxdIzc HC:0588 VC:098 FC:39 I:00
$80/C539 EB          XBA                     A:0F00 X:0066 Y:0000 D:1E00 DB:80 S:1FED P:envmxdIzc HC:0624 VC:098 FC:39 I:00
$80/C53A 85 08       STA $08    [$00:1E08]   A:000F X:0066 Y:0000 D:1E00 DB:80 S:1FED P:envmxdIzc HC:0660 VC:098 FC:39 I:00
$80/C53C A4 06       LDY $06    [$00:1E06]   A:000F X:0066 Y:0000 D:1E00 DB:80 S:1FED P:envmxdIzc HC:0706 VC:098 FC:39 I:00
$80/C53E A2 00 00    LDX #$0000              A:000F X:0066 Y:0000 D:1E00 DB:80 S:1FED P:envmxdIZc HC:0752 VC:098 FC:39 I:00
$80/C541 20 D1 C7    JSR $C7D1  [$80:C7D1]   A:000F X:0000 Y:0000 D:1E00 DB:80 S:1FED P:envmxdIZc HC:0788 VC:098 FC:39 I:00
$80/C544 A2 33 00    LDX #$0033              A:0028 X:00A4 Y:0000 D:1E00 DB:80 S:1FED P:envmxdIzc HC:1330 VC:098 FC:39 I:00
$80/C547 20 8B C8    JSR $C88B  [$80:C88B]   A:0028 X:0033 Y:0000 D:1E00 DB:80 S:1FED P:envmxdIzc HC:1366 VC:098 FC:39 I:00
$80/C54A 29 00 FF    AND #$FF00              A:07F8 X:0033 Y:0000 D:1E00 DB:80 S:1FED P:envmxdIzc HC:0390 VC:099 FC:39 I:00
$80/C54D EB          XBA                     A:0700 X:0033 Y:0000 D:1E00 DB:80 S:1FED P:envmxdIzc HC:0426 VC:099 FC:39 I:00
$80/C54E 18          CLC                     A:0007 X:0033 Y:0000 D:1E00 DB:80 S:1FED P:envmxdIzc HC:0462 VC:099 FC:39 I:00
$80/C54F 65 08       ADC $08    [$00:1E08]   A:0007 X:0033 Y:0000 D:1E00 DB:80 S:1FED P:envmxdIzc HC:0492 VC:099 FC:39 I:00
$80/C551 85 08       STA $08    [$00:1E08]   A:0016 X:0033 Y:0000 D:1E00 DB:80 S:1FED P:envmxdIzc HC:0538 VC:099 FC:39 I:00
$80/C553 A6 06       LDX $06    [$00:1E06]   A:0016 X:0033 Y:0000 D:1E00 DB:80 S:1FED P:envmxdIzc HC:0624 VC:099 FC:39 I:00
$80/C555 20 6A C6    JSR $C66A  [$80:C66A]   A:0016 X:0000 Y:0000 D:1E00 DB:80 S:1FED P:envmxdIZc HC:0682 VC:099 FC:39 I:00
$80/C558 A2 33 00    LDX #$0033              A:00DC X:00DF Y:0000 D:1E00 DB:80 S:1FED P:envmxdIzc HC:0032 VC:100 FC:39 I:00
$80/C55B 20 8B C8    JSR $C88B  [$80:C88B]   A:00DC X:0033 Y:0000 D:1E00 DB:80 S:1FED P:envmxdIzc HC:0068 VC:100 FC:39 I:00
$80/C55E 29 00 FF    AND #$FF00              A:2BD4 X:0033 Y:0000 D:1E00 DB:80 S:1FED P:envmxdIzc HC:0456 VC:100 FC:39 I:00
$80/C561 EB          XBA                     A:2B00 X:0033 Y:0000 D:1E00 DB:80 S:1FED P:envmxdIzc HC:0492 VC:100 FC:39 I:00
$80/C562 18          CLC                     A:002B X:0033 Y:0000 D:1E00 DB:80 S:1FED P:envmxdIzc HC:0528 VC:100 FC:39 I:00
$80/C563 65 08       ADC $08    [$00:1E08]   A:002B X:0033 Y:0000 D:1E00 DB:80 S:1FED P:envmxdIzc HC:0598 VC:100 FC:39 I:00
$80/C565 6B          RTL                     A:0041 X:0033 Y:0000 D:1E00 DB:80 S:1FED P:envmxdIzc HC:0644 VC:100 FC:39 I:00


=========================================



$80/C0DD AE 23 11    LDX $1123  [$80:1123]   A:0041 X:0033 Y:0000 D:1E00 DB:80 S:1FF0 P:envmxdIzc HC:0750 VC:100 FC:39 I:00
$80/C0E0 A0 0C 00    LDY #$000C              A:0041 X:0000 Y:0000 D:1E00 DB:80 S:1FF0 P:envmxdIZc HC:0802 VC:100 FC:39 I:00
$80/C0E3 22 85 C5 80 JSL $80C585[$80:C585]   A:0041 X:0000 Y:000C D:1E00 DB:80 S:1FF0 P:envmxdIzc HC:0838 VC:100 FC:39 I:00


base defense -- rooks = $19
$80/C0E7 BF 4F C0 80 LDA $80C04F,x[$80:C04F] A:0000 X:0000 Y:000C D:1E00 DB:80 S:1FF0 P:envmxdIZc HC:0024 VC:101 FC:39 I:00
$80/C0EB A2 33 00    LDX #$0033              A:0080 X:0000 Y:000C D:1E00 DB:80 S:1FF0 P:envmxdIzc HC:0078 VC:101 FC:39 I:00
$80/C0EE 20 8B C8    JSR $C88B  [$80:C88B]   A:0080 X:0033 Y:000C D:1E00 DB:80 S:1FF0 P:envmxdIzc HC:0114 VC:101 FC:39 I:00
$80/C0F1 29 00 FF    AND #$FF00              A:1980 X:0033 Y:000C D:1E00 DB:80 S:1FF0 P:envmxdIzc HC:0502 VC:101 FC:39 I:00
$80/C0F4 EB          XBA                     A:1900 X:0033 Y:000C D:1E00 DB:80 S:1FF0 P:envmxdIzc HC:0102 VC:101 FC:26 I:00


+ armor bonus + level bonus
$80/C0F5 18          CLC                     A:0019 X:0033 Y:000C D:1E00 DB:80 S:1FF0 P:envmxdIzc HC:0126 VC:101 FC:26 I:00
$80/C0F6 65 02       ADC $02    [$00:1E02]   A:0019 X:0033 Y:000C D:1E00 DB:80 S:1FF0 P:envmxdIzc HC:0144 VC:101 FC:26 I:00
$80/C0F8 85 02       STA $02    [$00:1E02]   A:005A X:0033 Y:000C D:1E00 DB:80 S:1FF0 P:envmxdIzc HC:0178 VC:101 FC:26 I:00


$80/C0FA A9 FF 00    LDA #$00FF              A:005A X:0033 Y:000C D:1E00 DB:80 S:1FF0 P:envmxdIzc HC:0212 VC:101 FC:26 I:00
$80/C0FD 38          SEC                     A:00FF X:0033 Y:000C D:1E00 DB:80 S:1FF0 P:envmxdIzc HC:0236 VC:101 FC:26 I:00
$80/C0FE E5 02       SBC $02    [$00:1E02]   A:00FF X:0033 Y:000C D:1E00 DB:80 S:1FF0 P:envmxdIzC HC:0254 VC:101 FC:26 I:00


~~ damage % amount -- $a5 = 0.64453125 x full damage
$80/C100 AA          TAX                     A:00A5 X:0033 Y:000C D:1E00 DB:80 S:1FF0 P:envmxdIzC HC:0288 VC:101 FC:26 I:00


get full damage amount??
$80/C101 A5 00       LDA $00    [$00:1E00]   A:00A5 X:00A5 Y:000C D:1E00 DB:80 S:1FF0 P:envmxdIzC HC:0306 VC:101 FC:26 I:00
$80/C103 20 A1 C8    JSR $C8A1  [$80:C8A1]   A:0041 X:00A5 Y:000C D:1E00 DB:80 S:1FF0 P:envmxdIzC HC:0340 VC:101 FC:26 I:00



======================================================

$80/C8A1 85 22       STA $22    [$00:1E22]   A:0050 X:00D1 Y:0008 D:1E00 DB:80 S:1FEB P:envmxdIzC HC:0616 VC:096 FC:26 I:00
$80/C8A3 20 8B C8    JSR $C88B  [$80:C88B]   A:0050 X:00D1 Y:0008 D:1E00 DB:80 S:1FEB P:envmxdIzC HC:0650 VC:096 FC:26 I:00


$80/C8A6 85 24       STA $24    [$00:1E24]   A:4150 X:00D1 Y:0008 D:1E00 DB:80 S:1FEB P:envmxdIzC HC:1026 VC:096 FC:26 I:00
$80/C8A8 A5 22       LDA $22    [$00:1E22]   A:4150 X:00D1 Y:0008 D:1E00 DB:80 S:1FEB P:envmxdIzC HC:1060 VC:096 FC:26 I:00
$80/C8AA EB          XBA                     A:0050 X:00D1 Y:0008 D:1E00 DB:80 S:1FEB P:envmxdIzC HC:1094 VC:096 FC:26 I:00
$80/C8AB 20 8B C8    JSR $C88B  [$80:C88B]   A:5000 X:00D1 Y:0008 D:1E00 DB:80 S:1FEB P:envmxdIZC HC:1160 VC:096 FC:26 I:00


$80/C8AE 85 22       STA $22    [$00:1E22]   A:0000 X:00D1 Y:0008 D:1E00 DB:80 S:1FEB P:envmxdIZC HC:0172 VC:097 FC:26 I:00
$80/C8B0 29 00 FF    AND #$FF00              A:0000 X:00D1 Y:0008 D:1E00 DB:80 S:1FEB P:envmxdIZC HC:0206 VC:097 FC:26 I:00
$80/C8B3 EB          XBA                     A:0000 X:00D1 Y:0008 D:1E00 DB:80 S:1FEB P:envmxdIZC HC:0230 VC:097 FC:26 I:00
$80/C8B4 AA          TAX                     A:0000 X:00D1 Y:0008 D:1E00 DB:80 S:1FEB P:envmxdIZC HC:0254 VC:097 FC:26 I:00
$80/C8B5 A5 22       LDA $22    [$00:1E22]   A:0000 X:0000 Y:0008 D:1E00 DB:80 S:1FEB P:envmxdIZC HC:0272 VC:097 FC:26 I:00
$80/C8B7 29 FF 00    AND #$00FF              A:0000 X:0000 Y:0008 D:1E00 DB:80 S:1FEB P:envmxdIZC HC:0306 VC:097 FC:26 I:00
$80/C8BA EB          XBA                     A:0000 X:0000 Y:0008 D:1E00 DB:80 S:1FEB P:envmxdIZC HC:0330 VC:097 FC:26 I:00
$80/C8BB 18          CLC                     A:0000 X:0000 Y:0008 D:1E00 DB:80 S:1FEB P:envmxdIZC HC:0354 VC:097 FC:26 I:00
$80/C8BC 65 24       ADC $24    [$00:1E24]   A:0000 X:0000 Y:0008 D:1E00 DB:80 S:1FEB P:envmxdIZc HC:0372 VC:097 FC:26 I:00
$80/C8BE 90 01       BCC $01    [$C8C1]      A:4150 X:0000 Y:0008 D:1E00 DB:80 S:1FEB P:envmxdIzc HC:0406 VC:097 FC:26 I:00
$80/C8C1 60          RTS                     A:4150 X:0000 Y:0008 D:1E00 DB:80 S:1FEB P:envmxdIzc HC:0430 VC:097 FC:26 I:00

======================================================


final damage
$80/C106 29 00 FF    AND #$FF00              A:29E5 X:0000 Y:000C D:1E00 DB:80 S:1FF0 P:envmxdIzc HC:0286 VC:102 FC:26 I:00
$80/C109 85 00       STA $00    [$00:1E00]   A:2900 X:0000 Y:000C D:1E00 DB:80 S:1FF0 P:envmxdIzc HC:0310 VC:102 FC:26 I:00



$80/C10B 8A          TXA                     A:2900 X:0000 Y:000C D:1E00 DB:80 S:1FF0 P:envmxdIzc HC:0344 VC:102 FC:26 I:00
$80/C10C 05 00       ORA $00    [$00:1E00]   A:0000 X:0000 Y:000C D:1E00 DB:80 S:1FF0 P:envmxdIZc HC:0362 VC:102 FC:26 I:00
$80/C10E EB          XBA                     A:2900 X:0000 Y:000C D:1E00 DB:80 S:1FF0 P:envmxdIzc HC:0396 VC:102 FC:26 I:00
$80/C10F 85 00       STA $00    [$00:1E00]   A:0029 X:0000 Y:000C D:1E00 DB:80 S:1FF0 P:envmxdIzc HC:0420 VC:102 FC:26 I:00





$80/C111 AE 21 11    LDX $1121  [$80:1121]   A:0029 X:0000 Y:000C D:1E00 DB:80 S:1FF0 P:envmxdIzc HC:0454 VC:102 FC:26 I:00
$80/C114 AC 23 11    LDY $1123  [$80:1123]   A:0029 X:0008 Y:000C D:1E00 DB:80 S:1FF0 P:envmxdIzc HC:0494 VC:102 FC:26 I:00
$80/C117 20 B1 C5    JSR $C5B1  [$80:C5B1]   A:0029 X:0008 Y:0000 D:1E00 DB:80 S:1FF0 P:envmxdIZc HC:0534 VC:102 FC:26 I:00


$80/C11A AA          TAX                     A:0002 X:0005 Y:0003 D:1E00 DB:80 S:1FF0 P:envmxdIzc HC:0538 VC:113 FC:26 I:00
$80/C11B BF 76 C1 80 LDA $80C176,x[$80:C178] A:0002 X:0002 Y:0003 D:1E00 DB:80 S:1FF0 P:envmxdIzc HC:0596 VC:113 FC:26 I:00
$80/C11F A6 00       LDX $00    [$00:1E00]   A:0100 X:0002 Y:0003 D:1E00 DB:80 S:1FF0 P:envmxdIzc HC:0638 VC:113 FC:26 I:00
$80/C121 22 39 8A 80 JSL $808A39[$80:8A39]   A:0100 X:0029 Y:0003 D:1E00 DB:80 S:1FF0 P:envmxdIzc HC:0672 VC:113 FC:26 I:00


$80/C125 A5 01       LDA $01    [$00:1E01]   A:0000 X:0000 Y:0003 D:1E00 DB:80 S:1FF0 P:envmxdIZc HC:0616 VC:114 FC:26 I:00
$80/C127 85 00       STA $00    [$00:1E00]   A:0029 X:0000 Y:0003 D:1E00 DB:80 S:1FF0 P:envmxdIzc HC:0650 VC:114 FC:26 I:00
$80/C129 AE 21 11    LDX $1121  [$80:1121]   A:0029 X:0000 Y:0003 D:1E00 DB:80 S:1FF0 P:envmxdIzc HC:0684 VC:114 FC:26 I:00
$80/C12C AC 23 11    LDY $1123  [$80:1123]   A:0029 X:0008 Y:0003 D:1E00 DB:80 S:1FF0 P:envmxdIzc HC:0724 VC:114 FC:26 I:00
$80/C12F 20 0C C3    JSR $C30C  [$80:C30C]   A:0029 X:0008 Y:0000 D:1E00 DB:80 S:1FF0 P:envmxdIZc HC:0764 VC:114 FC:26 I:00

So first it makes sure A is between the values at $00 and $02. (BCC/BCS are tricky to remember). Then it looks like $1121 and $1123 are player offsets to load their stats.

-$C4CA loads max damage into $(1E)00.
-$C526 loads the player defense value through several subs.
-->$C781's value is multiplied by #$0066 and divided by 256 (the top byte is taken).
-->$C7D1's value * #$0033 / 256, then added to the total.
-->$C66A's value * #$0033 / 256, then added to the total... which is stored in $02.
(These constants are probably where I could modify how effective the stats are, once I figure out which stat is which.)

Next... I guess we're skipping $C585.
-$C04F,x loads the player's base defense, then * #$0033 / 256.
-This is added into the "player defense value" in $02.
-This modified defense (mDef) is subtracted from FF to get their damage reduction % (DR%).
-Then at $C8A1 it... multiplies the full damage (D) by DR% and stores in $1E24.
-Then it byte-swaps D, multiplies by DR%/256 (stores in X), multiplies by 256, and adds it to the total in $1E24.
...I don't really get what it's doing there, and it looks like some of these traces don't match, but D * DR%/256 should give the reduced damage. After that point I get lost, but I see it going back to referencing the character offsets $1121/1123.

So this is disregarding race/element/buff bonuses (which I expect are multipliers), but it helps to know that damage reduction is largely percentage-based.
EDIT: $C3E1 checks the target's element.

EDIT2:
rainponcho! Your multi-levelup works TOO WELL! This is from killing a Slime in a new game.
(http://i.imgur.com/QdJrGIk.png)
(The game soft-locked after this)  :laugh: :laugh:
For some reason Rooks started with $555F EXP to the next level.
Title: Re: Arcana - Seal of Rimsala! (SNES)
Post by: Time/SpaceMage on August 08, 2017, 01:48:51 pm
By the way, $33/$FF is 51/256 or 0.199 (nearly 1/5). $66/$FF is 102/256 or 0.398 (about 2/5). So it's like those values are being divided by 5. Except, y'know, floating-point math.

So if I called those 3 sub-functions' stats D1-D3, the defense value Def would be:
Def = 2*D1/5 + D2/5 + D3/5.

Base Defense "bDef" would be added to make the modified Defense "mDef":
mDef = Def + bDef/5
DR% = $FF - mDef
Title: Re: Arcana - Seal of Rimsala! (SNES)
Post by: TimeSpaceMage on August 09, 2017, 04:05:11 am
Quote
For some reason Rooks started with $555F EXP to the next level.

So when the game first initializes Rooks' EXP to next level, it uses $07/B29F to store $0A to $1363. Problem is, hijacking it there calls an ADC with the current value, which before initialization is $5555. So, you may need to STZ $1363 (and STZ $1365 for the Spirit) on startup, or add it with another STZ like $81/821F (STZ $1393). That's max HP values, so I doubt it would get called more than once.

To test out the multi-levelup, enemy EXP is loaded to $136B-7A.
Title: Re: Arcana - Seal of Rimsala! (SNES)
Post by: KingMike on August 09, 2017, 10:47:21 am
If you're talking about uninitialized RAM, technically it is random values.
But emulators may default to filling RAM (and I assume SRAM) with certain values (such as the 0x55 and 0xAA, or alternating bits, pattern SNES9x has used).
Title: Re: Arcana - Seal of Rimsala! (SNES)
Post by: rainponcho on August 09, 2017, 12:28:53 pm
Quote
So when the game first initializes Rooks' EXP to next level, it uses $07/B29F to store $0A to $1363. Problem is, hijacking it there calls an ADC with the current value, which before initialization is $5555. So, you may need to STZ $1363 (and STZ $1365 for the Spirit) on startup, or add it with another STZ like $81/821F (STZ $1393). That's max HP values, so I doubt it would get called more than once.

Yup, thanks (!) I get the problem(s) now. Didn't think about when new characters join party ==> mega bug!

Can't believe you figured out damage formula so quickly. I stared at that for awhile and thought meh; have other things to do. Starting to think you're better at asm than I am. :)

Will try to get something working for levelup. ^^


edit:
new levelup idea
https://www.sendspace.com/file/8vw1l5


Moved exp gain up to 87:B29B. And following up on KingMike's expert observation about uninit ram (thanks for this!), cleared out that area of memory on bootup (~$30 bytes worth to be safe). It should work properly now.

Vanilla game writes to current exp first, before writing to max hp.


edit2:
Gave fight with 1 Goblin 65535 exp. Rooks + Teefa (Tifa?) = LV36 and stopped. Also used a cheat code to force Rooks exp = 0 always. LV60 and stopped.


edit3:
Bad news. Thought of how it could break - game over screen. So either reset data on new game, load game. Or maybe when a new person enters party, it flips that active member switch from 0 -> 1 somewhere around there.
Title: Re: Arcana - Seal of Rimsala! (SNES)
Post by: SCO on August 12, 2017, 09:25:32 am
Haven't forgotten about uploading a standalone fastrom patch for vanilla. After optimizing Super Ghouls 'n Ghosts to playable levels, learned some new tricks.

Speaking of that, i just submitted a critical review on that hack because i noticed that the intro was broken. At first i thought it was because of confusion between the base game (no-intro vs. goodset or similar) as i've seen other games break, but now i'm not so sure. Can you tell me if it happens to you and what game should be used as base?

I suppose it might be a confusion with the graphical part having a different origin rom and the hacking part having the no-intro rom and and the combination going wonky.
Title: Re: Arcana - Seal of Rimsala! (SNES)
Post by: TimeSpaceMage on September 08, 2017, 05:17:55 pm
Well that was a fun hiatus! Let's see what I can get done before my class starts at the end of the month.

new levelup idea
https://www.sendspace.com/file/8vw1l5


Moved exp gain up to 87:B29B. And following up on KingMike's expert observation about uninit ram (thanks for this!), cleared out that area of memory on bootup (~$30 bytes worth to be safe). It should work properly now.

So, turns out this has a major bug too. 87:B29B is also called when switching spirits with Call, so switching between 2 spirits will ADC their "EXP" each time. This causes a softlock after battle. (You can avoid this bug by only switching from the Empty slot to a spirit, but after getting Marid this means you'd have to end all battles with Sylph or Efrite active!)

For the record, here's the vanilla code:
Code: [Select]
Load the character offset (2=Active Spirit)
$07/B292 7A          PLY                     A:0000 X:0000 Y:0004 D:1E00 DB:00 S:1FF1 P:envmxdIZc HC:0400 VC:047 FC:38 I:00

Load their LV and left shift.
$07/B293 B9 7B 13    LDA $137B,y[$00:137D]   A:0000 X:0000 Y:0002 D:1E00 DB:00 S:1FF3 P:envmxdIzc HC:0452 VC:047 FC:38 I:00
$07/B296 0A          ASL A                   A:0028 X:0000 Y:0002 D:1E00 DB:00 S:1FF3 P:envmxdIzc HC:0514 VC:047 FC:38 I:00

Add their LV*2 to a byte offset $00 ($78 * ID#)
$07/B297 18          CLC                     A:0050 X:0000 Y:0002 D:1E00 DB:00 S:1FF3 P:envmxdIzc HC:0584 VC:047 FC:38 I:00
$07/B298 65 00       ADC $00    [$00:1E00]   A:0050 X:0000 Y:0002 D:1E00 DB:00 S:1FF3 P:envmxdIzc HC:0614 VC:047 FC:38 I:00
$07/B29A AA          TAX                     A:0230 X:0000 Y:0002 D:1E00 DB:00 S:1FF3 P:envmxdIzc HC:0662 VC:047 FC:38 I:00

Use the offset to get the Spirit's new "EXP" value and store it.
$07/B29B BF 1A A9 05 LDA $05A91A,x[$05:AB4A] A:0230 X:0230 Y:0002 D:1E00 DB:00 S:1FF3 P:envmxdIzc HC:0692 VC:047 FC:38 I:00
$07/B29F 99 63 13    STA $1363,y[$00:1365]   A:1B58 X:0230 Y:0002 D:1E00 DB:00 S:1FF3 P:envmxdIzc HC:0756 VC:047 FC:38 I:00

And here's where rainponcho's code comes in.
Code: [Select]
$87/B292 7A          PLY                     A:0000 X:0000 Y:0004 D:1E00 DB:80 S:1FF1 P:envmxdIZc HC:1048 VC:041 FC:55 I:00
$87/B293 B9 7B 13    LDA $137B,y[$80:137D]   A:0000 X:0000 Y:0002 D:1E00 DB:80 S:1FF3 P:envmxdIzc HC:1094 VC:041 FC:55 I:00
$87/B296 0A          ASL A                   A:001E X:0000 Y:0002 D:1E00 DB:80 S:1FF3 P:envmxdIzc HC:1188 VC:041 FC:55 I:00
$87/B297 18          CLC                     A:003C X:0000 Y:0002 D:1E00 DB:80 S:1FF3 P:envmxdIzc HC:1212 VC:041 FC:55 I:00
$87/B298 65 00       ADC $00    [$00:1E00]   A:003C X:0000 Y:0002 D:1E00 DB:80 S:1FF3 P:envmxdIzc HC:1236 VC:041 FC:55 I:00
$87/B29A AA          TAX                     A:00B4 X:0000 Y:0002 D:1E00 DB:80 S:1FF3 P:envmxdIzc HC:1276 VC:041 FC:55 I:00

ADC's the current EXP ($1363) before storing it.
$87/B29B 5C A1 FF 87 JMP $87FFA1[$87:FFA1]   A:00B4 X:00B4 Y:0002 D:1E00 DB:80 S:1FF3 P:envmxdIzc HC:1300 VC:041 FC:55 I:00
$87/FFA1 BF 1A A9 85 LDA $85A91A,x[$85:A9CE] A:00B4 X:00B4 Y:0002 D:1E00 DB:80 S:1FF3 P:envmxdIzc HC:1336 VC:041 FC:55 I:00
$87/FFA5 18          CLC                     A:07D0 X:00B4 Y:0002 D:1E00 DB:80 S:1FF3 P:envmxdIzc HC:0020 VC:042 FC:55 I:00
$87/FFA6 79 63 13    ADC $1363,y[$80:1365]   A:07D0 X:00B4 Y:0002 D:1E00 DB:80 S:1FF3 P:envmxdIzc HC:0044 VC:042 FC:55 I:00
$87/FFA9 99 63 13    STA $1363,y[$80:1365]   A:1770 X:00B4 Y:0002 D:1E00 DB:80 S:1FF3 P:envmxdIzc HC:0096 VC:042 FC:55 I:00

So it's a pretty simple (useful) edit, but the kicker is that it's always run. I'm going to look for a variable to check if a battle has been won, and skip the ADC if it's not. After that I'll take a look at what he meant about the game over screen >.>

EDIT: I decided to make the code check the current music ($1064) for the Battle Win theme ($55). I'm pretty sure that is foolproof  :D


Code: [Select]
ADC's the current EXP ($1363) before storing it.
$87/B29B 5C A1 FF 87 JMP $87FFA1
$87/FFA1 BF 1A A9 85 LDA $85A91A,x

Added these lines; skips to the STA if Battle Win isn't playing.
$87/FFA5 AE 64 10    LDX $1064
$87/FFA8 E0 55 00    CPX #$0055
$87/FFAB D0 04       BNE $04

$87/FFAD 18          CLC
$87/FFAE 79 63 13    ADC $1363,y
$87/FFB1 99 63 13    STA $1363,y
$87/FFB4 6B          RTL

Also, I repointed the zeroing code:
$80/8112 22 AD FF 87 JSL $87FFAD
$80/8112 22 B5 FF 87 JSL $87FFB5

Here's the updated version! (https://www.sendspace.com/file/m2jjo8)

Annnnd now Level Select has graphics glitches in the dungeons until finishing a battle. But, only for Chapter 2. Um, what?  :o
...Wait, that bug shows up before my bugfix too. It's caused by the FastROM patch v2.

EDIT2: Confirmed Game Over no longer breaks the game under levelup v0.3.
Title: Re: Arcana - Seal of Rimsala! (SNES)
Post by: TimeSpaceMage on September 21, 2017, 12:10:16 am
So I'm going to leave fixing the FastROM patch to rainponcho. It's gonna take me awhile to figure out what his code changed, and there's emulator-dependent graphics glitches too. At first I thought it was just Ch2 stage select, but in no$sns it glitches in Balnea Temple as well. Finishing a battle clears the glitches, but returning from the map brings it back again.

Here's the latest progress!
-All treasure chest contents through Ch3 have been located in ROM, and can be freely edited. I'll finish documenting the rest in another 2 hours' work or so.

-Added a Broad Sword to the Ch2 stage select inventory so Darwin has something to swing when he joins.
Title: Re: Arcana - Seal of Rimsala! (SNES)
Post by: TimeSpaceMage on October 27, 2017, 12:15:26 am
Hey everyone! So I just identified some more spell data, their SFX. There's also SFX for the effects taking place (say for "Rooks' attribute has changed to Fire" or "Rooks' Attack Power has been increased"), which is stored 2 banks away from the spell data for some reason. So, now buff spells use what I call the "Lufia Buff" SFX. It's cool and adds a bit more variety to battles.  :)

Yeah, idk what happened to rainponcho. I sure hope he's all right...

EDIT:
Major update! I fixed the graphical issues with fastrom v0.2! I'm thrilled enough that I'd release the game right now, except now the game hangs after finishing the intro  :( So once I find what's causing that, I'm willing to release.

EDIT2:
GOT IT! Turns out it was a bad patch job. Confirmed FastROM v3 and Levelup v3 work with both vanilla and Seal of Rimsala v0.941, so I added 0.942's changes and we're at v0.95! The game's ready to release pending some playtesting ^___^ It's been over 2 years, but it's finally coming out!
Title: Re: Arcana - Seal of Rimsala! (SNES) ~ FastROM bug fixed!
Post by: juef on January 31, 2018, 03:25:13 pm
Hey TimeSpaceMage! :) Any update regarding the hack?
Title: Re: Arcana - Seal of Rimsala! (SNES) ~ FastROM bug fixed!
Post by: Time/SpaceMage on February 01, 2018, 08:17:02 am
Thanks for the interest! No updates yet, but I will have time to work on it after I take my A+ certification tests in two weeks. This will help me get into IT, so it's very important to me!

There's still a major graphics bug with the FastROM patch when played in no$sns, and I want to finish going through the dialogue (and fitting it in between the unmovable event opcodes) before release. I can't wait to share it with you, though :)
Title: Re: Arcana - Seal of Rimsala! (SNES) ~ FastROM bug fixed!
Post by: Zeemis on February 01, 2018, 08:04:16 pm
This looks really amazing! I loved playing this back in the day on my SNES! :D
Title: Re: Arcana - Seal of Rimsala! (SNES) ~ FastROM bug fixed!
Post by: PersianImm0rtal on February 02, 2018, 02:11:21 am
I just wanted to say thank you for the hard work you put into this. I am going to test itt out on my super ufo! Thank thanks thanks!

Edit: Wait, Is this hack not on the site yet?
Title: Re: Arcana - Seal of Rimsala! (SNES) ~ FastROM bug fixed!
Post by: Time/SpaceMage on February 02, 2018, 07:50:57 am
No public release yet, unfortunately. I'm rather selective about its quality, since this is my first big project.

Don't worry, I'll release a news article for it so you won't miss it. It won't be in February, though. Although... having some beta testers could be handy :3 Shoot me a PM if you want a prerelease.
Title: Re: Arcana - Seal of Rimsala! (SNES) ~ FastROM bug fixed!
Post by: PersianImm0rtal on February 05, 2018, 05:28:18 pm
I think you have a hit on your hands based on this beta version.  :thumbsup:

I love hacks like this that take games that had great attributes and just modernizes them so that we can enjoy them without getting frustrated. The best change is the rate of random encounters.
Title: Re: Arcana - Seal of Rimsala! (SNES) ~ FastROM bug fixed!
Post by: Time/SpaceMage on February 06, 2018, 09:35:34 pm
Thanks! I'm more fired up about this now  :)
Since I had some free time after studying, I finished the script for Chapter 3 and the intro to Chapter 4. The story should make more sense now. Before it was like, "Oh, she's been hit with a sleep spell!" "Is she okay?" "Yes, she just needs to rest."
Title: Re: Arcana - Seal of Rimsala! (SNES) ~ FastROM bug fixed!
Post by: PersianImm0rtal on February 07, 2018, 12:46:31 am
So in chapter 1, when I enter the Temple I get glitched graphics, and then it goes away if I finish a battle, but if I look at the map, it comes back until I finish another combat.
Title: Re: Arcana - Seal of Rimsala! (SNES) ~ FastROM bug fixed!
Post by: sluffy on February 07, 2018, 09:46:47 am
Quote
and I want to finish going through the dialogue (and fitting it in between the unmovable event opcodes)

Would it be possible to invent your own scripting "jump" code that prints text from other 24-bit location and then "return" back to continue normal scripting routine?


Quote
So in chapter 1, when I enter the Temple I get glitched graphics, and then it goes away if I finish a battle, but if I look at the map, it comes back until I finish another combat.

rainponcho's FastROM patch doesn't work on real hardware (see review). I've had this exact problem and other strange graphic stuff just using that hack. Tried contacting rainponcho but no response for awhile now. :(


Can't help but think all the different (emulator graphic) glitches are because of "unstable" dma hacks constantly used to give quick boosts at bad times; irq and nmi timing conflicts would be my guess.

Just a thought though.
Title: Re: Arcana - Seal of Rimsala! (SNES) ~ FastROM bug fixed!
Post by: Time/SpaceMage on February 07, 2018, 10:16:07 am
Would it be possible to invent your own scripting "jump" code that prints text from other 24-bit location and then "return" back to continue normal scripting routine?


rainponcho's FastROM patch doesn't work on real hardware (see review). I've had this exact problem and other strange graphic stuff just using that hack. Tried contacting rainponcho but no response for awhile now. :(


Can't help but think all the different (emulator graphic) glitches are because of "unstable" dma hacks constantly used to give quick boosts at bad times; irq and nmi timing conflicts would be my guess.

Just a thought though.
There might be a code for that, like when rainponcho listed codes for the scripting language. If so then I could expand the text used in games. Most of the time I just need to be clever with my words to fit it in, which is fun in its own right. But, I'll see if I can't figure out a jump routine.

So his patch has that bug on all real hardware? That's a real bummer! Also hard to test, since I don't really understand what he did. I'm literally reversing groups of byte changes until I find the offender.

And yeah, rainponcho dropped off the face of the earth :x Hope he's ok, but I don't think he's coming back.
Title: Re: Arcana - Seal of Rimsala! (SNES) ~ FastROM bug fixed!
Post by: PersianImm0rtal on February 07, 2018, 10:56:29 pm
In chapter 2 the graphics get glitched when you open the map, and then it goes away after a battle.    :(
Title: Re: Arcana - Seal of Rimsala! (SNES) ~ FastROM bug fixed!
Post by: TimeSpaceMage on February 09, 2018, 12:55:10 am
That was the problem before too, but it went away on Snes9x.  :(

So, here are the byte changes his FastROM patch made to the original. To shorten the list, I'll remove the entries that just change the bank (00 -> 80).

Code: [Select]
Comparing files Arcana_base+fastrom.smc and Arcana_base.smc:
00000770: 22 E2
00000771: 9D 20
00000772: FB 85
00000773: 9F 02

000007C4: 5C B7
000007C5: A8 00
000007C6: FB C8
000007C7: 9F 9D

000007D6: 5C B7
000007D7: EC 00
000007D8: FB C8
000007D9: 9F 5A

0000082E: 5C B9
0000082F: 2C 00
00000830: FC 00
00000831: 9F 9D

00000870: 5C B9
00000871: 4F 00
00000872: FC 00
00000873: 9F 9D

0000089D: 5C A9
0000089E: 28 E0
0000089F: FD 95
000008A0: 9F 01

00001532: 22 A7
00001533: 30 10
00001534: FB 29
00001535: 9F FF
00001536: EA 00

00001B0E: 4C DC
00001B0F: 9E 49
00001B10: FF 10

00007F90: 78 FF
00007F91: 18 FF
00007F92: FB FF
00007F93: E2 FF
00007F94: 20 FF
00007F95: A9 FF
00007F96: 01 FF
00007F97: 8D FF
00007F98: 0D FF
00007F99: 42 FF
00007F9A: 5C FF
00007F9B: 01 FF
00007F9C: 80 FF
00007F9D: 80 FF
00007F9E: 08 FF
00007F9F: E2 FF
00007FA0: 20 FF
00007FA1: 48 FF
00007FA2: AD FF
00007FA3: 4B FF
00007FA4: 10 FF
00007FA5: C9 FF
00007FA6: 40 FF
00007FA7: B0 FF
00007FA8: 05 FF
00007FA9: 09 FF
00007FAA: 80 FF
00007FAB: 8D FF
00007FAC: 4B FF
00007FAD: 10 FF
00007FAE: 68 FF
00007FAF: 28 FF
00007FB0: DC FF
00007FB1: 49 FF
00007FB2: 10 FF
00007FFC: 90 01
00007FFD: FF 80

000199B1: 22 8B
000199B2: 42 A9
000199B3: FB FF
000199B4: 9F FF
000199B5: 60 8F

000FFB30: A7 FF
000FFB31: 10 FF
000FFB32: 29 FF
000FFB34: 00 FF
000FFB35: C9 FF
000FFB36: 40 FF
000FFB37: 00 FF
000FFB38: B0 FF
000FFB39: 03 FF
000FFB3A: 09 FF
000FFB3B: 80 FF
000FFB3C: 00 FF
000FFB3D: 6B FF
000FFB3E: 00 FF
000FFB3F: 00 FF
000FFB42: 08 FF
000FFB43: A9 FF
000FFB44: 20 FF
000FFB45: 13 FF
000FFB46: 8D FF
000FFB47: 65 FF
000FFB48: 43 FF
000FFB49: A9 FF
000FFB4A: 40 FF
000FFB4B: FB FF
000FFB4C: 8D FF
000FFB4D: 62 FF
000FFB4E: 43 FF
000FFB4F: A9 FF
000FFB50: FB FF
000FFB51: 9F FF
000FFB52: 8D FF
000FFB53: 63 FF
000FFB54: 43 FF
000FFB55: A9 FF
000FFB56: E0 FF
000FFB57: CC FF
000FFB58: 8D FF
000FFB59: 81 FF
000FFB5A: 21 FF
000FFB5B: A9 FF
000FFB5C: CC FF
000FFB5D: 7E FF
000FFB5E: 8D FF
000FFB5F: 82 FF
000FFB60: 21 FF
000FFB61: A9 FF
000FFB62: 08 FF
000FFB63: 80 FF
000FFB64: 8D FF
000FFB65: 60 FF
000FFB66: 43 FF
000FFB67: E2 FF
000FFB68: 20 FF
000FFB69: A9 FF
000FFB6A: 40 FF
000FFB6B: 8D FF
000FFB6C: 0B FF
000FFB6D: 42 FF
000FFB6E: C2 FF
000FFB6F: 20 FF
000FFB70: A9 FF
000FFB71: 40 FF
000FFB72: 26 FF
000FFB73: 8D FF
000FFB74: 65 FF
000FFB75: 43 FF
000FFB76: A9 FF
000FFB77: 3E FF
000FFB78: FB FF
000FFB79: 8D FF
000FFB7A: 62 FF
000FFB7B: 43 FF
000FFB7C: A9 FF
000FFB7D: FB FF
000FFB7E: 9F FF
000FFB7F: 8D FF
000FFB80: 63 FF
000FFB81: 43 FF
000FFB82: A9 FF
000FFB83: A0 FF
000FFB84: A6 FF
000FFB85: 8D FF
000FFB86: 81 FF
000FFB87: 21 FF
000FFB88: A9 FF
000FFB89: A6 FF
000FFB8A: 7E FF
000FFB8B: 8D FF
000FFB8C: 82 FF
000FFB8D: 21 FF
000FFB8E: A9 FF
000FFB8F: 08 FF
000FFB90: 80 FF
000FFB91: 8D FF
000FFB92: 60 FF
000FFB93: 43 FF
000FFB94: E2 FF
000FFB95: 20 FF
000FFB96: A9 FF
000FFB97: 40 FF
000FFB98: 8D FF
000FFB99: 0B FF
000FFB9A: 42 FF
000FFB9B: 28 FF
000FFB9C: 6B FF
000FFB9D: E2 FF
000FFB9E: 20 FF
000FFB9F: C9 FF
000FFBA0: 40 FF
000FFBA1: B0 FF
000FFBA2: 02 FF
000FFBA3: 09 FF
000FFBA4: 80 FF
000FFBA5: 85 FF
000FFBA6: 02 FF
000FFBA7: 6B FF
000FFBA8: C2 FF
000FFBA9: 20 FF
000FFBAA: A5 FF
000FFBAB: 03 FF
000FFBAC: 8F FF
000FFBAD: 65 FF
000FFBAE: 43 FF
000FFBAF: 80 FF
000FFBB0: 98 FF
000FFBB1: 18 FF
000FFBB2: 65 FF
000FFBB3: 00 FF
000FFBB4: 8F FF
000FFBB5: 62 FF
000FFBB6: 43 FF
000FFBB7: 80 FF
000FFBB8: 8A FF
000FFBB9: 8F FF
000FFBBA: 81 FF
000FFBBB: 21 FF
000FFBBC: 80 FF
000FFBBD: A9 FF
000FFBBE: 00 FF
000FFBBF: 80 FF
000FFBC0: 8F FF
000FFBC1: 60 FF
000FFBC2: 43 FF
000FFBC3: 80 FF
000FFBC4: E2 FF
000FFBC5: 20 FF
000FFBC6: A5 FF
000FFBC7: 02 FF
000FFBC8: 09 FF
000FFBC9: 80 FF
000FFBCA: 8F FF
000FFBCB: 64 FF
000FFBCC: 43 FF
000FFBCD: 80 FF
000FFBCE: 8B FF
000FFBCF: 68 FF
000FFBD0: 8F FF
000FFBD1: 83 FF
000FFBD2: 21 FF
000FFBD3: 80 FF
000FFBD4: A9 FF
000FFBD5: 40 FF
000FFBD6: 8F FF
000FFBD7: 0B FF
000FFBD8: 42 FF
000FFBD9: 80 FF
000FFBDA: C2 FF
000FFBDB: 20 FF
000FFBDC: 8A FF
000FFBDD: 18 FF
000FFBDE: 65 FF
000FFBDF: 03 FF
000FFBE0: AA FF
000FFBE1: 98 FF
000FFBE2: 18 FF
000FFBE3: 65 FF
000FFBE4: 03 FF
000FFBE5: A8 FF
000FFBE6: E2 FF
000FFBE7: 20 FF
000FFBE8: 5C FF
000FFBE9: 7C FF
000FFBEA: 87 FF
000FFBEB: 80 FF
000FFBEC: C2 FF
000FFBED: 20 FF
000FFBEE: A5 FF
000FFBEF: 03 FF
000FFBF0: 8F FF
000FFBF1: 65 FF
000FFBF2: 43 FF
000FFBF3: 80 FF
000FFBF4: 98 FF
000FFBF5: 18 FF
000FFBF6: 65 FF
000FFBF7: 00 FF
000FFBF8: 8F FF
000FFBF9: 62 FF
000FFBFA: 43 FF
000FFBFB: 80 FF
000FFBFC: 8A FF
000FFBFD: 8F FF
000FFBFE: 81 FF
000FFBFF: 21 FF
000FFC00: 80 FF
000FFC01: A9 FF
000FFC02: 08 FF
000FFC03: 80 FF
000FFC04: 8F FF
000FFC05: 60 FF
000FFC06: 43 FF
000FFC07: 80 FF
000FFC08: E2 FF
000FFC09: 20 FF
000FFC0A: A5 FF
000FFC0B: 02 FF
000FFC0C: 09 FF
000FFC0D: 80 FF
000FFC0E: 8F FF
000FFC0F: 64 FF
000FFC10: 43 FF
000FFC11: 80 FF
000FFC12: 8B FF
000FFC13: 68 FF
000FFC14: 8F FF
000FFC15: 83 FF
000FFC16: 21 FF
000FFC17: 80 FF
000FFC18: A9 FF
000FFC19: 40 FF
000FFC1A: 8F FF
000FFC1B: 0B FF
000FFC1C: 42 FF
000FFC1D: 80 FF
000FFC1E: C2 FF
000FFC1F: 20 FF
000FFC20: 8A FF
000FFC21: 18 FF
000FFC22: 65 FF
000FFC23: 03 FF
000FFC24: AA FF
000FFC25: C8 FF
000FFC26: E2 FF
000FFC27: 20 FF
000FFC28: 5C FF
000FFC29: 7C FF
000FFC2A: 87 FF
000FFC2B: 80 FF
000FFC2C: C2 FF
000FFC2D: 20 FF
000FFC2E: 8A FF
000FFC2F: BB FF
000FFC30: A8 FF
000FFC31: 8B FF
000FFC32: 8B FF
000FFC33: 68 FF
000FFC34: C9 FF
000FFC35: 7F FF
000FFC36: 7F FF
000FFC37: F0 FF
000FFC38: 08 FF
000FFC39: A5 FF
000FFC3A: 03 FF
000FFC3B: 3A FF
000FFC3C: 54 FF
000FFC3D: 7E FF
000FFC3E: 7E FF
000FFC3F: 80 FF
000FFC40: 06 FF
000FFC41: A5 FF
000FFC42: 03 FF
000FFC43: 3A FF
000FFC44: 54 FF
000FFC45: 7F FF
000FFC46: 7F FF
000FFC47: BB FF
000FFC48: E2 FF
000FFC49: 20 FF
000FFC4A: 7A FF
000FFC4B: 5C FF
000FFC4C: 7C FF
000FFC4D: 87 FF
000FFC4E: 80 FF
000FFC4F: C2 FF
000FFC50: 20 FF
000FFC51: A5 FF
000FFC52: 03 FF
000FFC53: C9 FF
000FFC54: 10 FF
000FFC55: 00 FF
000FFC56: 90 FF
000FFC57: 4E FF
000FFC58: 98 FF
000FFC59: 38 FF
000FFC5A: E9 FF
000FFC5B: 10 FF
000FFC5C: 00 FF
000FFC5D: A8 FF
000FFC5E: B9 FF
000FFC5F: 0F FF
000FFC60: 00 FF
000FFC61: EB FF
000FFC62: 9D FF
000FFC63: 00 FF
000FFC64: 00 FF
000FFC65: B9 FF
000FFC66: 0D FF
000FFC67: 00 FF
000FFC68: EB FF
000FFC69: 9D FF
000FFC6A: 02 FF
000FFC6B: 00 FF
000FFC6C: B9 FF
000FFC6D: 0B FF
000FFC6E: 00 FF
000FFC6F: EB FF
000FFC70: 9D FF
000FFC71: 04 FF
000FFC72: 00 FF
000FFC73: B9 FF
000FFC74: 09 FF
000FFC75: 00 FF
000FFC76: EB FF
000FFC77: 9D FF
000FFC78: 06 FF
000FFC79: 00 FF
000FFC7A: B9 FF
000FFC7B: 07 FF
000FFC7C: 00 FF
000FFC7D: EB FF
000FFC7E: 9D FF
000FFC7F: 08 FF
000FFC80: 00 FF
000FFC81: B9 FF
000FFC82: 05 FF
000FFC83: 00 FF
000FFC84: EB FF
000FFC85: 9D FF
000FFC86: 0A FF
000FFC87: 00 FF
000FFC88: B9 FF
000FFC89: 03 FF
000FFC8A: 00 FF
000FFC8B: EB FF
000FFC8C: 9D FF
000FFC8D: 0C FF
000FFC8E: 00 FF
000FFC8F: B9 FF
000FFC90: 01 FF
000FFC91: 00 FF
000FFC92: EB FF
000FFC93: 9D FF
000FFC94: 0E FF
000FFC95: 00 FF
000FFC96: 8A FF
000FFC97: 18 FF
000FFC98: 69 FF
000FFC99: 10 FF
000FFC9A: 00 FF
000FFC9B: AA FF
000FFC9C: A5 FF
000FFC9D: 03 FF
000FFC9E: 38 FF
000FFC9F: E9 FF
000FFCA0: 10 FF
000FFCA1: 00 FF
000FFCA2: 85 FF
000FFCA3: 03 FF
000FFCA4: 80 FF
000FFCA5: AB FF
000FFCA6: C9 FF
000FFCA7: 08 FF
000FFCA8: 00 FF
000FFCA9: 90 FF
000FFCAA: 30 FF
000FFCAB: 98 FF
000FFCAC: 38 FF
000FFCAD: E9 FF
000FFCAE: 08 FF
000FFCAF: 00 FF
000FFCB0: A8 FF
000FFCB1: B9 FF
000FFCB2: 07 FF
000FFCB3: 00 FF
000FFCB4: EB FF
000FFCB5: 9D FF
000FFCB6: 00 FF
000FFCB7: 00 FF
000FFCB8: B9 FF
000FFCB9: 05 FF
000FFCBA: 00 FF
000FFCBB: EB FF
000FFCBC: 9D FF
000FFCBD: 02 FF
000FFCBE: 00 FF
000FFCBF: B9 FF
000FFCC0: 03 FF
000FFCC1: 00 FF
000FFCC2: EB FF
000FFCC3: 9D FF
000FFCC4: 04 FF
000FFCC5: 00 FF
000FFCC6: B9 FF
000FFCC7: 01 FF
000FFCC8: 00 FF
000FFCC9: EB FF
000FFCCA: 9D FF
000FFCCB: 06 FF
000FFCCC: 00 FF
000FFCCD: 8A FF
000FFCCE: 18 FF
000FFCCF: 69 FF
000FFCD0: 08 FF
000FFCD1: 00 FF
000FFCD2: AA FF
000FFCD3: A5 FF
000FFCD4: 03 FF
000FFCD5: 38 FF
000FFCD6: E9 FF
000FFCD7: 08 FF
000FFCD8: 00 FF
000FFCD9: 85 FF
000FFCDA: 03 FF
000FFCDB: C9 FF
000FFCDC: 04 FF
000FFCDD: 00 FF
000FFCDE: 90 FF
000FFCDF: 1E FF
000FFCE0: 88 FF
000FFCE1: 88 FF
000FFCE2: 88 FF
000FFCE3: 88 FF
000FFCE4: B9 FF
000FFCE5: 03 FF
000FFCE6: 00 FF
000FFCE7: EB FF
000FFCE8: 9D FF
000FFCE9: 00 FF
000FFCEA: 00 FF
000FFCEB: B9 FF
000FFCEC: 01 FF
000FFCED: 00 FF
000FFCEE: EB FF
000FFCEF: 9D FF
000FFCF0: 02 FF
000FFCF1: 00 FF
000FFCF2: E8 FF
000FFCF3: E8 FF
000FFCF4: E8 FF
000FFCF5: E8 FF
000FFCF6: A5 FF
000FFCF7: 03 FF
000FFCF8: 38 FF
000FFCF9: E9 FF
000FFCFA: 04 FF
000FFCFB: 00 FF
000FFCFC: 85 FF
000FFCFD: 03 FF
000FFCFE: C9 FF
000FFCFF: 02 FF
000FFD00: 00 FF
000FFD01: 90 FF
000FFD02: 13 FF
000FFD03: 88 FF
000FFD04: 88 FF
000FFD05: B9 FF
000FFD06: 01 FF
000FFD07: 00 FF
000FFD08: EB FF
000FFD09: 9D FF
000FFD0A: 00 FF
000FFD0B: 00 FF
000FFD0C: E8 FF
000FFD0D: E8 FF
000FFD0E: A5 FF
000FFD0F: 03 FF
000FFD10: 38 FF
000FFD11: E9 FF
000FFD12: 02 FF
000FFD13: 00 FF
000FFD14: 85 FF
000FFD15: 03 FF
000FFD16: E2 FF
000FFD17: 20 FF
000FFD18: 3A FF
000FFD19: D0 FF
000FFD1A: 08 FF
000FFD1B: B9 FF
000FFD1C: 00 FF
000FFD1D: 00 FF
000FFD1E: 9D FF
000FFD1F: 00 FF
000FFD20: 00 FF
000FFD21: 88 FF
000FFD22: E8 FF
000FFD23: 7A FF
000FFD24: 5C FF
000FFD25: 7C FF
000FFD26: 87 FF
000FFD27: 80 FF
000FFD28: E2 FF
000FFD29: 20 FF
000FFD2A: A9 FF
000FFD2B: E0 FF
000FFD2C: E0 FF
000FFD2D: 81 FF
000FFD2E: 03 FF
000FFD2F: B0 FF
000FFD30: 4A FF
000FFD31: 95 FF
000FFD32: 01 FF
000FFD33: 95 FF
000FFD34: 05 FF
000FFD35: 95 FF
000FFD36: 09 FF
000FFD37: 95 FF
000FFD38: 0D FF
000FFD39: 95 FF
000FFD3A: 11 FF
000FFD3B: 95 FF
000FFD3C: 15 FF
000FFD3D: 95 FF
000FFD3E: 19 FF
000FFD3F: 95 FF
000FFD40: 1D FF
000FFD41: 95 FF
000FFD42: 21 FF
000FFD43: 95 FF
000FFD44: 25 FF
000FFD45: 95 FF
000FFD46: 29 FF
000FFD47: 95 FF
000FFD48: 2D FF
000FFD49: 95 FF
000FFD4A: 31 FF
000FFD4B: 95 FF
000FFD4C: 35 FF
000FFD4D: 95 FF
000FFD4E: 39 FF
000FFD4F: 95 FF
000FFD50: 3D FF
000FFD51: 95 FF
000FFD52: 41 FF
000FFD53: 95 FF
000FFD54: 45 FF
000FFD55: 95 FF
000FFD56: 49 FF
000FFD57: 95 FF
000FFD58: 4D FF
000FFD59: 95 FF
000FFD5A: 51 FF
000FFD5B: 95 FF
000FFD5C: 55 FF
000FFD5D: 95 FF
000FFD5E: 59 FF
000FFD5F: 95 FF
000FFD60: 5D FF
000FFD61: 95 FF
000FFD62: 61 FF
000FFD63: 95 FF
000FFD64: 65 FF
000FFD65: 95 FF
000FFD66: 69 FF
000FFD67: 95 FF
000FFD68: 6D FF
000FFD69: 95 FF
000FFD6A: 71 FF
000FFD6B: 95 FF
000FFD6C: 75 FF
000FFD6D: 95 FF
000FFD6E: 79 FF
000FFD6F: 95 FF
000FFD70: 7D FF
000FFD71: C2 FF
000FFD72: 20 FF
000FFD73: 8A FF
000FFD74: 18 FF
000FFD75: 69 FF
000FFD76: 80 FF
000FFD77: 00 FF
000FFD78: AA FF
000FFD79: 80 FF
000FFD7A: AD FF
000FFD7B: E0 FF
000FFD7C: C1 FF
000FFD7D: 03 FF
000FFD7E: B0 FF
000FFD7F: 2C FF
000FFD80: 95 FF
000FFD81: 01 FF
000FFD82: 95 FF
000FFD83: 05 FF
000FFD84: 95 FF
000FFD85: 09 FF
000FFD86: 95 FF
000FFD87: 0D FF
000FFD88: 95 FF
000FFD89: 11 FF
000FFD8A: 95 FF
000FFD8B: 15 FF
000FFD8C: 95 FF
000FFD8D: 19 FF
000FFD8E: 95 FF
000FFD8F: 1D FF
000FFD90: 95 FF
000FFD91: 21 FF
000FFD92: 95 FF
000FFD93: 25 FF
000FFD94: 95 FF
000FFD95: 29 FF
000FFD96: 95 FF
000FFD97: 2D FF
000FFD98: 95 FF
000FFD99: 31 FF
000FFD9A: 95 FF
000FFD9B: 35 FF
000FFD9C: 95 FF
000FFD9D: 39 FF
000FFD9E: 95 FF
000FFD9F: 3D FF
000FFDA0: C2 FF
000FFDA1: 20 FF
000FFDA2: 8A FF
000FFDA3: 18 FF
000FFDA4: 69 FF
000FFDA5: 40 FF
000FFDA6: 00 FF
000FFDA7: AA FF
000FFDA8: E2 FF
000FFDA9: 20 FF
000FFDAA: A9 FF
000FFDAB: E1 FF
000FFDAC: E0 FF
000FFDAD: E1 FF
000FFDAE: 03 FF
000FFDAF: B0 FF
000FFDB0: 1C FF
000FFDB1: 95 FF
000FFDB2: 01 FF
000FFDB3: 95 FF
000FFDB4: 05 FF
000FFDB5: 95 FF
000FFDB6: 09 FF
000FFDB7: 95 FF
000FFDB8: 0D FF
000FFDB9: 95 FF
000FFDBA: 11 FF
000FFDBB: 95 FF
000FFDBC: 15 FF
000FFDBD: 95 FF
000FFDBE: 19 FF
000FFDBF: 95 FF
000FFDC0: 1D FF
000FFDC1: C2 FF
000FFDC2: 20 FF
000FFDC3: 8A FF
000FFDC4: 18 FF
000FFDC5: 69 FF
000FFDC6: 20 FF
000FFDC7: 00 FF
000FFDC8: AA FF
000FFDC9: E2 FF
000FFDCA: 20 FF
000FFDCB: A9 FF
000FFDCC: E1 FF
000FFDCD: E0 FF
000FFDCE: F1 FF
000FFDCF: 03 FF
000FFDD0: B0 FF
000FFDD1: 14 FF
000FFDD2: 95 FF
000FFDD3: 01 FF
000FFDD4: 95 FF
000FFDD5: 05 FF
000FFDD6: 95 FF
000FFDD7: 09 FF
000FFDD8: 95 FF
000FFDD9: 0D FF
000FFDDA: C2 FF
000FFDDB: 20 FF
000FFDDC: 8A FF
000FFDDD: 18 FF
000FFDDE: 69 FF
000FFDDF: 10 FF
000FFDE0: 00 FF
000FFDE1: AA FF
000FFDE2: E2 FF
000FFDE3: 20 FF
000FFDE4: A9 FF
000FFDE5: E1 FF
000FFDE6: E0 FF
000FFDE7: F9 FF
000FFDE8: 03 FF
000FFDE9: B0 FF
000FFDEA: 10 FF
000FFDEB: 95 FF
000FFDEC: 01 FF
000FFDED: 95 FF
000FFDEE: 05 FF
000FFDEF: C2 FF
000FFDF0: 20 FF
000FFDF1: 8A FF
000FFDF2: 18 FF
000FFDF3: 69 FF
000FFDF4: 08 FF
000FFDF5: 00 FF
000FFDF6: AA FF
000FFDF7: E2 FF
000FFDF8: 20 FF
000FFDF9: A9 FF
000FFDFA: E1 FF
000FFDFB: E0 FF
000FFDFC: 00 FF
000FFDFD: 04 FF
000FFDFE: B0 FF
000FFDFF: 06 FF
000FFE00: 95 FF
000FFE01: 01 FF
000FFE02: E8 FF
000FFE03: E8 FF
000FFE04: E8 FF
000FFE05: E8 FF
000FFE06: 5C FF
000FFE07: AA FF
000FFE08: 88 FF
000FFE09: 80 FF
So for my fix, I reverted 8 bytes (0x770-773 and 0x7C4-7C7) that were causing gfx junk to appear. It looks like the bulk of his code is FFB30-FFE09. Wow, I can't believe he wrote almost $200 bytes of assembly... Well my next step will be trying to revert the other small groups, and if that doesn't work I'll have to disassemble that monster.  :-X Wish me luck guys! If anyone can give some input on FastROM conversion I'd really appreciate it.

February 09, 2018, 12:55:30 am - (Auto Merged - Double Posts are not allowed before 7 days.)
Also I documented more of the script opcodes. They still don't really make sense  :laugh: Tracing the opcodes hasn't led anywhere yet. $80/209B bounces all over the place, and when I trace the opcodes I can see where they're being read all at once, but not so much where they're being followed. For instance at 0x62256, the first 4 bytes "10 A5 FA 0C" mean to pause, then newline.  Next is "10 E3 F7 0C", which has Rooks speak without his picture showing. All the dialogue-related codes start with 10 and end with 0C, but I'm not sure HOW it works.

Code: [Select]
rainponcho's notes
$80/902B = where it reads scripting code
07 = run asm code (24-bit addr)
0c = jump if false (16-bit addr)
1b = jsr (16-bit addr)
1c = ret
And this just confuses me even more  :P
Title: Re: Arcana - Seal of Rimsala! (SNES) ~ FastROM bug fixed!
Post by: sluffy on February 09, 2018, 09:49:25 am
Lots of weird crap so I just take guesses. :p

770 just.. flips [rd] bank to 80+ if between 00-3F. And that causes junk to appear??
7c4/7d6 dma rom ==> ram
82e mvn ram copy
870 loop unrolls?
89d oam loop unroll (invalid sprite maybe)
1532/1b0e looks like 770 again (fastbank)
7f90 boot fastrom switch
199b1 appears to .. init ram via dma ..

That's what I could make out. Ugh.



I'm interested enough in trying out an independent faster rom conversion, to cross-check for problems. Not going to use rainponcho as a base since I have learned own ideas on what to do. This takes me (lots of) months though.

Faster rom means.. flipping the banks. And optimizing code - using look-up tables, removing loops, restructuring blocks, writing own spc transfer routines, disabling interrupts during lengthy "no update" screens, cycle counting, register cache, misc.



Did basic fastrom treatment. Ohohh. Ow. This game is buggy.
- dma $1800 size during active vblank. Fails. Already getting graphical glitches due to incomplete vram transfers.

- writes to 420c/420d every nmi. 420d is written using uninitialized ram. 50/50 chance you get fastrom or slowrom.

- reads 4216/4217 after 2 nop cycles. This sounds like a bad idea but game works so maybe .. still sounds awful. Need to check this harder


Does anyone know of other snes quirks to watch for? It'd be nice if there's a bgb-like debugger that catches illegal or "questionable" stuff and prints it out somewhere / auto-break. ^^
Title: Re: Arcana - Seal of Rimsala! (SNES) ~ FastROM bug fixed! ...kinda.
Post by: TimeSpaceMage on February 10, 2018, 10:06:04 pm
Yeah I'm not surprised this game is buggy. When reverting the level-up text to match the Japanese version (1 button press instead of 7), I found the English version has a hard-coded counter to tell it how many times to pause for input on that one screen. Along with the opcode to pause for input (7F), I literally had to track down a 07 and change it to a 01.

I'll try reverting 89d and see what happens. In the meantime, I'll rebuild my beta keeping the FastROM patch separate and just soft patch it. Thanks for the guesses :D
EDIT: 89d didn't fix the Heal crash in no$sns. I made a "minus fastrom" patch but soft patching it makes the game softlock after the Chapter 1 screen. Looks like I'll have to add my changes by hand again :x
EDIT2: Also no dice with 7D6, 82E, 870 reverted all at once, nor with 1532/1B0E reverted. So that leaves the last 3 groups... I'm guessing it's an issue with 199b1 since you said it was initializing RAM.

An emulator that catches stupid code sounds amazing. I can do some searching, but I haven't heard of one before.
Title: Re: Arcana - Seal of Rimsala! (SNES) ~ FastROM bug fixed! ...kinda.
Post by: sluffy on February 20, 2018, 10:31:55 pm
I really should get back on the ball with this. Game likes to over-transfer data and it tends to drop sometimes.

Code: [Select]
max transfer size
$80/BFF3 C9 01 18    CMP #$1801              A:1B90 X:10C3 Y:0000 D:1DE1 DB:80 S:1FEF P:envmxdIzC HC:0934 VC:202 FC:06 I:00
$80/BFF6 B0 0B       BCS $0B    [$C003]      A:1B90 X:10C3 Y:0000 D:1DE1 DB:80 S:1FEF P:envmxdIzC HC:0958 VC:202 FC:06 I:00


1-time transfer
$00/BFF8 A9 FF FF    LDA #$FFFF              A:0000 X:0000 Y:0000 D:0000 DB:00 S:01FF P:EnvmxdIzc HC:0238 VC:000 FC:00 I:00
$00/BFFB 8D 1D 11    STA $111D  [$00:111D]   A:0000 X:0000 Y:0000 D:0000 DB:00 S:01FF P:EnvmxdIzc HC:0254 VC:000 FC:00 I:00
$00/BFFE 9C 1F 11    STZ $111F  [$00:111F]   A:0000 X:0000 Y:0000 D:0000 DB:00 S:01FF P:EnvmxdIzc HC:0270 VC:000 FC:00 I:00
$00/C001 80 0C       BRA $0C    [$C00F]      A:0000 X:0000 Y:0000 D:0000 DB:00 S:01FF P:EnvmxdIzc HC:0286 VC:000 FC:00 I:00


split transfers
$80/C003 A9 00 18    LDA #$1800              A:1B90 X:10C3 Y:0000 D:1DE1 DB:80 S:1FEF P:envmxdIzC HC:0982 VC:202 FC:06 I:00
$80/C006 85 04       STA $04    [$00:1DE5]   A:1800 X:10C3 Y:0000 D:1DE1 DB:80 S:1FEF P:envmxdIzC HC:1006 VC:202 FC:06 I:00

$80/C008 18          CLC                     A:1800 X:10C3 Y:0000 D:1DE1 DB:80 S:1FEF P:envmxdIzC HC:1046 VC:202 FC:06 I:00
$80/C009 6D 1D 11    ADC $111D  [$80:111D]   A:1800 X:10C3 Y:0000 D:1DE1 DB:80 S:1FEF P:envmxdIzc HC:1064 VC:202 FC:06 I:00
$80/C00C 8D 1D 11    STA $111D  [$80:111D]   A:1810 X:10C3 Y:0000 D:1DE1 DB:80 S:1FEF P:envmxdIzc HC:1104 VC:202 FC:06 I:00


$1801/$1800 = way too much. Set mine at $1401/$1400, which cuts it close. Could lower another $100 on safe side maybe..

DMA[0]: CPU->PPU Mode:1 0x7E4010->0x2118 Bytes:1400 (inc) V:229 VRAM: 5008 (1,0) word
$80/84AC 8C 0B 42    STY $420B  [$80:420B]   A:5008 X:0060 Y:0001 D:0000 DB:80 S:1FDF P:envmXdIzc HC:1214 VC:229 FC:19 I:00
$80/84AF 4C 69 84    JMP $8469  [$80:8469]   A:5008 X:0060 Y:0001 D:0000 DB:80 S:1FDF P:envmXdIzc HC:1196 VC:260 FC:19 I:00


Random graphic glitches disappear for me with generic fastrom build. Have to see if I can trigger heal bug on no$sns. Does it happen with vanilla too or just rainponcho's fast or seal of rimsala edition?
Title: Re: Arcana - Seal of Rimsala! (SNES) ~ FastROM bug fixed! ...kinda.
Post by: Time/SpaceMage on February 21, 2018, 07:58:46 am
The bug is with rainponcho's FastROM patch. The rest of SoR just changes data and doesnt touch the code.
Title: Re: Arcana - Seal of Rimsala! (SNES) ~ FastROM bug fixed! ...kinda.
Post by: sluffy on February 23, 2018, 09:27:38 pm
no$sns -- tried Heal with just FastROM patch on-site but no hangs, crashes. Maybe I'm doing it wrong.
Title: Re: Arcana - Seal of Rimsala! (SNES) ~ FastROM bug fixed! ...kinda.
Post by: PersianImm0rtal on April 08, 2018, 12:18:46 am
When is the final release?
Title: Re: Arcana - Seal of Rimsala! (SNES) ~ FastROM bug fixed! ...kinda.
Post by: Time/SpaceMage on April 08, 2018, 03:32:43 pm
No release date yet, until this bug is narrowed down so it can be played on real hardware! At this point I think it's in the level up patch. I should have some time to take a look tonight.

If you're impatient and want a pre-release build to beta, shoot me a PM!
Title: Re: Arcana - Seal of Rimsala! (SNES) ~ FastROM bug fixed! ...kinda.
Post by: TimeSpaceMage on April 10, 2018, 05:05:09 pm
Well, I found the source of the Heal crash! This one's my bad  :-X
Turns out two of the spell animations I used make the game crash in no$sns, the white swirl for Heal spells and the white-blue swirl for Sleep.
Title: Re: Arcana - Seal of Rimsala! (SNES) ~ FastROM bug fixed! ...kinda.
Post by: sluffy on April 10, 2018, 07:22:43 pm
no$sns is buggy in its own ways, that doesn't happen elsewhere. That's from enough Canoe emu patch testing.


rainponcho did an amazing enough job fastrom'ing this game. I can't come close to the same optimizations. The actual renderer seems too rigid to make any faster. Without cheating using sa-1 which would kill most hardware enthusiasts.
Title: Re: Arcana - Seal of Rimsala! (SNES) ~ FastROM bug fixed! ...kinda.
Post by: PersianImm0rtal on April 12, 2018, 01:10:34 am
Just wanted to let you know I tried the latest beta you sent me, and it froze on a black screen after a few minutes after a few battles.


Tried starting a new game, and it freezes right after the beginning cutscene on a black screen, right after it says "Chapter One".

However, my save seems to work fine when I go back to the unhacked Arcana.
Title: Re: Arcana - Seal of Rimsala! (SNES) ~ FastROM bug fixed! ...kinda.
Post by: Time/SpaceMage on April 15, 2018, 10:02:03 am
Whoa, really? Maybe I did a bad patch job. I'll run it myself when I get off work but I swear I double checked it before sending.
Title: Re: Arcana - Seal of Rimsala! (SNES) ~ FastROM bug fixed! ...kinda.
Post by: SCO on April 18, 2018, 05:34:33 am
He didn't say in what emulator was this.
Title: Re: Arcana - Seal of Rimsala! (SNES) ~ FastROM bug fixed! ...kinda.
Post by: Time/SpaceMage on April 18, 2018, 07:38:59 am
Persian isn't using an emulator; he has a flash cart (Super UFO Pro 8 ).
And I patched it right, so one of those changes broke things. It softlocks for me too. Why spell animations would affect the first loading screen is beyond me... I'll fiddle around with it.
Title: Re: Arcana - Seal of Rimsala! (SNES) ~ FastROM bug fixed! ...kinda.
Post by: firedropdl on April 22, 2018, 10:34:01 am
This one is pretty exciting man.  Looking forward to playing it someday whenever I get around to fiddling with SNES stuff.  Me and my bros got this cart from Funcoland back in the day and loved it.  Thanks for your effort.  :)
Title: Re: Arcana - Seal of Rimsala! (SNES) ~ FastROM bug fixed! ...kinda.
Post by: PersianImm0rtal on May 13, 2018, 09:45:43 pm
Let me know when you need me to test the next beta version  ;D ;)