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

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

rainponcho

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

zombero

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

TimeSpaceMage

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

KingMike

  • Forum Moderator
  • Hero Member
  • *****
  • Posts: 6056
  • *sigh* A changed avatar. Big deal.
    • View Profile
Re: Arcana - Seal of Rimsala! (SNES)
« Reply #43 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?
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."

Time/SpaceMage

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

TimeSpaceMage

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



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
« Last Edit: August 01, 2017, 05:44:29 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."

Time/SpaceMage

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

rainponcho

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

TimeSpaceMage

  • Jr. Member
  • **
  • Posts: 43
    • View Profile
Re: Arcana - Seal of Rimsala! (SNES)
« Reply #48 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.
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 #49 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. ^^
« Last Edit: August 04, 2017, 08:07:15 pm by rainponcho »

TimeSpaceMage

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

TimeSpaceMage

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

(The game soft-locked after this)  :laugh: :laugh:
For some reason Rooks started with $555F EXP to the next level.
« Last Edit: August 08, 2017, 01:23:47 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."

Time/SpaceMage

  • Jr. Member
  • **
  • Posts: 11
    • View Profile
Re: Arcana - Seal of Rimsala! (SNES)
« Reply #53 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
« Last Edit: August 08, 2017, 01:59:08 pm by Time/SpaceMage »

TimeSpaceMage

  • Jr. Member
  • **
  • Posts: 43
    • View Profile
Re: Arcana - Seal of Rimsala! (SNES)
« Reply #54 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.
« Last Edit: August 09, 2017, 04:31:40 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."

KingMike

  • Forum Moderator
  • Hero Member
  • *****
  • Posts: 6056
  • *sigh* A changed avatar. Big deal.
    • View Profile
Re: Arcana - Seal of Rimsala! (SNES)
« Reply #55 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).
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."

rainponcho

  • Sr. Member
  • ****
  • Posts: 275
    • View Profile
Re: Arcana - Seal of Rimsala! (SNES)
« Reply #56 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.
« Last Edit: August 10, 2017, 11:29:46 am by rainponcho »

SCO

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

TimeSpaceMage

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

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.
« Last Edit: September 10, 2017, 08:55:55 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."