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

Author Topic: Arcana - Seal of Rimsala! (SNES)  (Read 4397 times)

TimeSpaceMage

  • Jr. Member
  • **
  • Posts: 44
    • View Profile
Arcana - Seal of Rimsala! (SNES)
« 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 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!



« Last Edit: September 10, 2017, 08:56:48 am by TimeSpaceMage »
Tinker: "You're going to go where no one has gone before!"
Hero: "We've actually been there before."
Tinker: "Oh. Well, you've never been shot out of a turret, with only a minimal chance of survival!"
Hero: "That's true."

SunGodPortal

  • Hero Member
  • *****
  • Posts: 2912
  • 2 + 2 = 5
    • View Profile
Re: Arcana - Seal of Rimsala! (SNES)
« Reply #1 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.
War is Peace. Freedom is Slavery. Ignorance is Strength.

KirkyMonster

  • Jr. Member
  • **
  • Posts: 50
    • View Profile
Re: Arcana - Seal of Rimsala! (SNES)
« Reply #2 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.

Zoinkity

  • Hero Member
  • *****
  • Posts: 552
    • View Profile
Re: Arcana - Seal of Rimsala! (SNES)
« Reply #3 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!

Time/SpaceMage

  • Jr. Member
  • **
  • Posts: 11
    • View Profile
Re: Arcana - Seal of Rimsala! (SNES)
« Reply #4 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.
« Last Edit: July 19, 2017, 11:57:52 am by Time/SpaceMage »

goldenband

  • Full Member
  • ***
  • Posts: 232
    • View Profile
Re: Arcana - Seal of Rimsala! (SNES)
« Reply #5 on: July 19, 2017, 01:23:02 pm »
Looking good! This should be a nice spruce-up for a deserving game. :)

rainponcho

  • Sr. Member
  • ****
  • Posts: 275
    • View Profile
Re: Arcana - Seal of Rimsala! (SNES)
« Reply #6 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.

Reiska

  • Full Member
  • ***
  • Posts: 108
    • View Profile
Re: Arcana - Seal of Rimsala! (SNES)
« Reply #7 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?
« Last Edit: July 20, 2017, 06:10:16 pm by Reiska »

TimeSpaceMage

  • Jr. Member
  • **
  • Posts: 44
    • View Profile
Re: Arcana - Seal of Rimsala! (SNES)
« Reply #8 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 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.)
Tinker: "You're going to go where no one has gone before!"
Hero: "We've actually been there before."
Tinker: "Oh. Well, you've never been shot out of a turret, with only a minimal chance of survival!"
Hero: "That's true."

rainponcho

  • Sr. Member
  • ****
  • Posts: 275
    • View Profile
Re: Arcana - Seal of Rimsala! (SNES)
« Reply #9 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:

TimeSpaceMage

  • Jr. Member
  • **
  • Posts: 44
    • View Profile
Re: Arcana - Seal of Rimsala! (SNES)
« Reply #10 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.)
Tinker: "You're going to go where no one has gone before!"
Hero: "We've actually been there before."
Tinker: "Oh. Well, you've never been shot out of a turret, with only a minimal chance of survival!"
Hero: "That's true."

rainponcho

  • Sr. Member
  • ****
  • Posts: 275
    • View Profile
Re: Arcana - Seal of Rimsala! (SNES)
« Reply #11 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. :)
« Last Edit: July 20, 2017, 09:55:30 pm by rainponcho »

TimeSpaceMage

  • Jr. Member
  • **
  • Posts: 44
    • View Profile
Re: Arcana - Seal of Rimsala! (SNES)
« Reply #12 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*

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.
« Last Edit: July 20, 2017, 10:41:23 pm by TimeSpaceMage »
Tinker: "You're going to go where no one has gone before!"
Hero: "We've actually been there before."
Tinker: "Oh. Well, you've never been shot out of a turret, with only a minimal chance of survival!"
Hero: "That's true."

rainponcho

  • Sr. Member
  • ****
  • Posts: 275
    • View Profile
Re: Arcana - Seal of Rimsala! (SNES)
« Reply #13 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.

Time/SpaceMage

  • Jr. Member
  • **
  • Posts: 11
    • View Profile
Re: Arcana - Seal of Rimsala! (SNES)
« Reply #14 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.
« Last Edit: July 21, 2017, 01:57:39 am by Time/SpaceMage »

rainponcho

  • Sr. Member
  • ****
  • Posts: 275
    • View Profile
Re: Arcana - Seal of Rimsala! (SNES)
« Reply #15 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. ^^

Time/SpaceMage

  • Jr. Member
  • **
  • Posts: 11
    • View Profile
Re: Arcana - Seal of Rimsala! (SNES)
« Reply #16 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.
 

KingMike

  • Forum Moderator
  • Hero Member
  • *****
  • Posts: 6062
  • *sigh* A changed avatar. Big deal.
    • View Profile
Re: Arcana - Seal of Rimsala! (SNES)
« Reply #17 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.)
Quote
Sir Howard Stringer, chief executive of Sony, on Christmas sales of the PS3:
"It's a little fortuitous that the Wii is running out of hardware."

magictrufflez

  • Sr. Member
  • ****
  • Posts: 472
    • View Profile
Re: Arcana - Seal of Rimsala! (SNES)
« Reply #18 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....

rainponcho

  • Sr. Member
  • ****
  • Posts: 275
    • View Profile
Re: Arcana - Seal of Rimsala! (SNES)
« Reply #19 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)
« Last Edit: July 21, 2017, 07:21:24 pm by rainponcho »