39D320 is the start of the RNG function, at the top of the file since I keep forgetting it.

39A648 - Let R4 be a datastore pointer
39A64A - Load datastore/0 (RN) into R0
39A64C - Let R1 = 0x1F
39A64E - AND R1 (0x1F) into R0 (RN)
39A650 - Store R0 (RN) at datastore/0
39A652 - Load datastore/0 (RN) into R0
39A654 - Add 84 to R0 (RN)
39A656 - Let R1 = 0
39A658 - Copy R1 (0) to R8
39A65A - Store R0 (variance) at datastore/0
39A65C - Load datastore/0 (variance) into R5
39A65E - Load datastore/2C (character data base) into R0
39A660 - Subtract 0x1B from R0 (character data base -> character inherent attack)
39A662 - Collect character inherent power into R7
39A664 - Add R7 (character power) to R5 (variance) and store in R0
39A666 - Store R0 (power combo) at datastore/0
39A668 - Load datastore/0 (power combo) into R6
39A66A - Multiple R6 (power combo) by 0x100
39A66C - Store R6 (power combo+) at datastore/0
39A66E - Load datastore/24 (enemy stat base) into R0
39A670 - Alter R0 (enemy stat base) to point to (enemy defence)
39A672 - Load R0/0 (enemy defence) into R7
39A674 - Store R7 (enemy defence) at datastore/4
39A676 - Load datastore/4 (enemy defence) into R5
39A678 - Multiply R5 (enemy defence) by 4 into R0
39A67A - Add R5 (enemy defence) to R0 (4x enemy defence) into R0 (now 5x enemy defence)
39A67C - Store R0 (5x enemy defence) at datastore/4
39A67E - Load datastore/4 (5x enemy defence) into R0
39A680 - Add 100 to R0 (5x enemy defence)
39A682 - Store R0 (enemy defence+) at datastore/4
39A684 - Load datastore/4 (enemy defence+) into R5
39A686 - Copy R6 (power combo+) into R0
39A688 - Copy R5 (enemy defence+) into R1
39A68A - Jump to 3CDF7C.a
39A68C - Jump to 3CDF7C.b
39A68E - Multiple R0 (???1) by 0x10000 into R7
39A690 - Copy R6 (power combo+) into R0
39A692 - Copy R5 (enemy defence+) into R1
39A694 - Jump to 3CDF04.a
39A696 - Jump to 3CDF04.b
39A698 - Load 0x0000FFFF into R1
39A69A - AND R0 (???2) into R1 (mask)
39A69C - OR R1 (masked ???2) into R7 (???1)
39A69E - Store R7 (???3) at datastore/0
39A6A0 - Load datastore/C (weapon number) into R0
39A6A2 - Store R0 (weapon number) at datastore/4
39A6A4 - Load datastore/4 (weapon number) into R5
39A6A6 - Let R0 = 0x7F
39A6A8 - AND R5 (weapon number) into R0 (0x7F) (clean off extraneous upper bytes)
39A6AA - Store R0 (weapon number) at datastore/4
39A6AC - Load datastore/4 (weapon number) into R5
39A6AE - Multiply R5 (weapon number) by 0x10 into R0
39A6B0 - Store R0 (weapon offset) at datastore/4
39A6B2 - Load the address 477BD7 into R0
39A6B4 - Load 0xFFFFDD7C into R2 (offset to weapon information)
39A6B6 - Add R2 (weapon info offset) into R0 (Data base)
39A6B8 - Let R3 = 0x4
39A6BA - Load datastore/R3(4) (shifted weapon number) into R1
39A6BC - Sub R1 (weapon offset) into R0 (weapon info offset) - R0 is now (weapon data base)
39A6BE - Store R0 (weapon data base) at datastore/30
39A6C0 - Copy R8 (???5) into R5
39A6C2 - Store R5 (???5) at datastore/4
39A6C4 - Load R0/0 (weapon power) into R7
39A6C6 - Store R7 (weapon power) at datastore/4
39A6C8 - Load datastore/4 (weapon power) into R0
39A6CA - Add 2 to R0 (weapon power)
39A6CC - Store R0 (boosted weapon power) at datastore/4
39A6CE - Load datastore/4 (boosted weapon power) into R5
39A6D0 - Load datastore/0 (???3) into R0
39A6D2 - Multiply R5 (boosted weapon power) into R0 (???3)
39A6D4 - Store R0 (multiplied power) at datastore/0
39A6D6 - Load datastore/0 (multiplied power) into R0
39A6D8 - Divide R0 (multiplied power) by 0x100
39A6DA - Store R0 (damage) at datastore/0
39A6DC - Let R6 be a datastore pointer
39A6DE - Load datastore/24 (enemy stat base) into R0
39A6E0 - Subtract 3 from R0 (enemy stat base) into R1
39A6E2 - Load R1/0 (enemy cHP) into R7
39A6E4 - Zero R0
39A6E6 - Copy R0 (zero) into R9
39A6E8 - Load datastore/0 (damage) into R0
39A6EA - Compare R0 (damage) to R7 (enemy cHP)
39A6EC - If R0 (damage) < R7 (enemy cHP), jump to 39A6F2

...I don't believe any more of this needs doing.

Thus far, damage is ((weapon power + 2) * ???3) / 0x100.

Need ???3, which is basically ???2 + ???1. So try and figure out what ???1 is.

The first jump...

3CDF7C - Compare R1 (enemy defence+) to 0
3CDF7E - If zero, jump to 3CE032
3CDF80 - Let R3 = 0x01
3CDF82 - Compare R0 (power combo+) to R1 (enemy defence+)
3CDF84 - If R0 > R1, jump to 3CDF88

3CDF88 - Push R4 (datastore)
3CDF8A - Let R4 = 0x01
3CDF8C - Multiply R4 (1) by 0x10000000
3CDF8E - Compare R1 (enemy defence+) to R4 (0x10000000)
3CDF90 - If R1 > R4, jump to 3CDF9C
3CDF92 - Compare R1 (enemy defence+) to R0 (power combo+)
3CDF94 - If R1 > R0, jump to 3CDF9C
3CDF96 - Multiply R1 (enemy defence+) by 0x10
3CDF98 - Multiple R3 (1) by 0x10
3CDF9A - Jump back to 3CDF8E

will hit a jump to 3CDF9C eventually, R1 will contain (shifted enemy defence) R3 will contain (shift amount)

3CDF9C - Multiply R4 (0x10000000) by 0x08
3CDF9E - Compare R1 (shifted enemy defence) to R4 (0x80000000)
3CDFA0 - If R1 > R4, jump to 3CDFAC
3CDFA2 - Compare R1 (shifted enemy defence) to R0 (power combo+)
3CDFA4 - If R1 > R0, jump to 3CDFAC

I gather this is here for if power is over 0x10000000 o_O dunno what happens if this fails to capture it either, probably isn't relevant

3CDFAC - Let R2 = zero
3CDFAE - Compare R0 (power combo+) to R1 (shifted enemy defence)
3CDFB0 - If R0 < R1, jump to 3CDFB4 <Skip 1>
3CDFB2 - Subtract R4 (shifted enemy defence) into R1 (power combo)
<Skip 1>
3CDFB4 - Let R4 = R1 (shifted enemy defence) / 2
3CDFB6 - Compare R0 (power combo+) to R4 (halved shifted E.D.)
3CDFB8 - If R0 < R4, jump to 3CDFC6 <Skip 2>
3CDFBA - Subtract R4 (halved shifted E.D.) into R0 (power combo+)
3CDFBC - Copy R3 (shift amount) into R12
3CDFBE - Let R4 = 1
3CDFC0 - Rotate R3 (shift amount) right by R4 (1)
3CDFC2 - OR R3 (rotated shift amount) into R2 (something tracker)
3CDFC4 - Copy R12 (shift copy) into R3
<Skip 2>
3CDFC6 - Let R4 = R1 (shifted enemy defence) / 4
3CDFC8 - Compare R0 (cut power combo) to R4 (quartered shifted E.D.)
3CDFCA - if R0 < R4, jump to 3CDFD8 <Skip 3>
3CDFCC - Subtract R4 (quartered shifted E.D.) into R0 (cut power combo)
3CDFCE - Copy R3 (shift amount) into R12
3CDFD0 - Let R4 = 2
3CDFD2 - Rotate R3 (shift amount) right by R4 (2)
3CDFD4 - OR R3 (rotated shift amount) into R2 (something tracker)
3CDFD6 - Copy R12 (shift copy) into R3
<Skip 3>
3CDFD8 - Let R4 = R1 (shifted enemy defence) / 8
3CDFDA - Compare R0 (cut power combo) to R4 (eighted shifted E.D.)
3CDFDC - If R0 < R4, jump to 3CDFEA <Skip 4>
3CDFDE - Subtract R4 (eigthed shifted E.D.) into R0 (cut power combo)
3CDFE0 - Copy R3 (shift amount) into R12
3CDFE2 - Let R4 = 3
3CDFE4 - Rotate R3 (shift amount) right by R4 (3)
3CDFE6 - OR R3 (rotated shift amount) into R2 (something tracker)
3CDFE8 - Copy R12 (shift copy) into R3
<Skip 4>
3CDFEA - Copy R3 (shit amount) into R12
3CDFEC - Compare R0 (cut power combo) to 0
3CDFEE - If R0 = 0, jump to 3CDFF8 <end loop1>
3CDFF0 - Divide R3 (shift amount) by 0x10
3CDFF2 - If R3 (shift amount) = 0, jump to 3CDFF8 <end loop1>
3CDFF4 - Divide R1 (shifted E.D) by 0x10
3CDFF6 - Jump to 3CDFAC

<end loop1>
3CDFF8 - Let R4 = 0x0e
3CDFFA - Multiply R4 (E) by 0x10000000
3CDFFC - AND R4 (0xE0000000) into R2 (final tracker result)
3CDFFE - If R4 != 0 (ie: defence was subtracted in the last loop of loop1) jump to 3CE004

...kay

3CE004 - Copy R12 (shift copy) into R3
3CE006 - Let R4 = 3
3CE008 - Rotate R3 (shift amount) right by R4 (3)
3CE00A - Test R2 with R3
3CE00C - If R2 didn't contain R3, jump to 3CE012

3CE012 - Copy R12 (shift copy) into R3
3CE014 - Let R4 = 2
3CE016 - Rotate R3 (shift amount) right by R4 (2)
3CE018 - Test R2 with R3
3CE01A - If R2 didn't contain R3, jump to 3CE020
3CE01C - Let R4 = R1 (shifted enemy defence) / 4
3CE01E - Add R4 (quartered shifted E.D) to R0 (cut power combo)

3CE020 - Copy R12 (shift copy) into R3
3CE022 - Let R4 = 1
3CE024 - Rotate R3 (shift amount) right by R4 (1)
3CE026 - Test R2 with R3
3CE028 - If R2 didn't contain R3, jump to 3CE02E

3CE02E - Pop into R4 (datastore)
3CE030 - Return

This has left me... mystified.

Maybe loop 2 will shed some light on things;_;

3CDF04 - Compare R1 (enemy defence+) to 0
3CDF06 - If R1 = 0, jump to 3CDF72
3CDF08 - Let R3 = 0x01
3CDF0A - Let R2 = 0x00
3CDF0C - Push R4 (datastore)
3CDF0E - Compare R0 (power combo+) to R1 (enemy defence+)
3CDF10 - If R0 < R1, jump to 3CDF6C
3CDF12 - Let R4 = 1
3CDF14 - Multiply R4 by 0x10000000
3CDF16 - Compare R1 (enemy defence+) to R4 (0x10000000)
3CDF18 - If R1 > R4, jump to 3CDF24
3CDF1A - Compare R1 (enemy defence+) to R0 (power combo+)
3CDF1C - If R1 > R0, jump to 3CDF24
3CDF1E - Multiply R1 (enemy defence+) by 0x10
3CDF20 - Multiply R3 (shift amount) by 0x10
3CDF22 - Jump to 3CDF16

we'll eventually have to come to 3CDF24, as in the last loop

3CDF24 - Multiply R4 (0x10000000) by 8
3CDF26 - Compare R1 (shifted ED) to R4 (0x80000000)
3CDF28 - If R1 > R4, jump to 3CDF34
3CDF2A - Compare R1 (shifted ED) to R0 (power combo+)
3CDF2C - if R1 > R0, jump to 3CDF34

3CDF34 - Compare R0 (power combo+) to R1 (shifted ED)
3CDF36 - If R0 < R1, jump to 3CDF3C <skip 1>
3CDF38 - Subtract R4 (shifted ED) into R0 (PC+)
3CDF3A - OR R3 into R2 (tracker)
<skip 1>
3CDF3C - Let R4 = R1 (shifted ED) / 2
3CDF3E - Compare R0 (power combo+) to R4 (halved shifted ED)
3CDF40 - if R0 < R4, jump to 3CDF48 <skip 2>
3CDF42 - Subtract R4 (halved shifted ED) into R0 (power combo+)
3CDF44 - Let R4 = R3 (shift amount) / 2
3CDF46 - OR R4 into R2 (tracker)
<skip 2>
3CDF48 - Let R4 = R1 (shifted ED) / 4
3CDF4A - Compare R0 (power combo+) to R4 (quartered shifted ED)
3CDF4C - If R0 < R4, jump to 3CDF54 <skip 3>
3CDF4E - Subtract R4 (quartered shifted ED) into R0 (cut PC)
3CDF50 - Let R4 = R3 (shift amount) / 4
3CDF52 - OR R4 into R2 (tracker)
<skip 3>
3CDF54 - Let R4 = R1 (shifted ED) / 8
3CDF56 - Compare R0 (cut PC) to R4 (eighted shifted ED)
3CDF58 - If R0 < R4, jump to 3CDF60 <skip 4>
3CDF5A - Subtract R4 (quartered shifted ED) into R0 (cut PC)
3CDF5C - Let R4 = R3 (shift amount) / 8
3CDF5E - OR R4 into R2 (tracker)
<skip 4>
3CDF60 - Compare R0 (cut PC) to 0
3CDF62 - If R0 = 0, jump to 3CDF6C <end loop2>
3CDF64 - Divide R3 (shift amount) by 0x10
3CDF66 - If R3 = 0, jump to 3CDF6C <end loop2>
3CDF68 - Divide R1 (shifted ED) by 0x10
3CDF6A - jump to 3CDF34

<end loop2>
3CDF6C - Copy R2 (tracker) to R0
3CDF6E - Pop to R4 (datastore)
3CDF70 - Return

so, ???1 is remainder and ???2 is quotient

copy out that last part again so it makes more sense...

39A68A - Jump to 3CDF7C.a
39A68C - Jump to 3CDF7C.b
39A68E - Multiply R0 (remainder) by 0x10000 into R7
39A690 - Copy R6 (power combo+) into R0
39A692 - Copy R5 (enemy defence+) into R1
39A694 - Jump to 3CDF04.a
39A696 - Jump to 3CDF04.b
39A698 - Load 0x0000FFFF into R1
39A69A - AND R0 (boosted attack/defence) into R1 (mask)
39A69C - OR R1 (boosted attack/defence) into R7 (shifted remainder)
39A69E - Store R7 (quotient, basically) at datastore/0
39A6A0 - Load datastore/C (weapon number) into R0
39A6A2 - Store R0 (weapon number) at datastore/4
39A6A4 - Load datastore/4 (weapon number) into R5
39A6A6 - Let R0 = 0x7F
39A6A8 - AND R5 (weapon number) into R0 (0x7F) (clean off extraneous upper bytes)
39A6AA - Store R0 (weapon number) at datastore/4
39A6AC - Load datastore/4 (weapon number) into R5
39A6AE - Multiply R5 (weapon number) by 0x10 into R0
39A6B0 - Store R0 (weapon offset) at datastore/4
39A6B2 - Load the address 477BD7 into R0
39A6B4 - Load 0xFFFFDD7C into R2 (offset to weapon information)
39A6B6 - Add R2 (weapon info offset) into R0 (Data base)
39A6B8 - Let R3 = 0x4
39A6BA - Load datastore/R3(4) (shifted weapon number) into R1
39A6BC - Sub R1 (weapon offset) into R0 (weapon info offset) - R0 is now (weapon data base)
39A6BE - Store R0 (weapon data base) at datastore/30
39A6C0 - Copy R8 (???5) into R5
39A6C2 - Store R5 (???5) at datastore/4
39A6C4 - Load R0/0 (weapon power) into R7
39A6C6 - Store R7 (weapon power) at datastore/4
39A6C8 - Load datastore/4 (weapon power) into R0
39A6CA - Add 2 to R0 (weapon power)
39A6CC - Store R0 (boosted weapon power) at datastore/4
39A6CE - Load datastore/4 (boosted weapon power) into R5
39A6D0 - Load datastore/0 (quotient) into R0 (halfword; remainder isn't taken)
39A6D2 - Multiply R5 (boosted weapon power) into R0 (quotient)
39A6D4 - Store R0 (multiplied power) at datastore/0
39A6D6 - Load datastore/0 (multiplied power) into R0
39A6D8 - Divide R0 (multiplied power) by 0x100
39A6DA - Store R0 (damage) at datastore/0
39A6DC - Let R6 be a datastore pointer
39A6DE - Load datastore/24 (enemy stat base) into R0
39A6E0 - Subtract 3 from R0 (enemy stat base) into R1
39A6E2 - Load R1/0 (enemy cHP) into R7
39A6E4 - Zero R0
39A6E6 - Copy R0 (zero) into R9
39A6E8 - Load datastore/0 (damage) into R0
39A6EA - Compare R0 (damage) to R7 (enemy cHP)
39A6EC - If R0 (damage) < R7 (enemy cHP), jump to 39A6F2

So damage is (((Inherent Attack + Random?) x 512) / ((5 x defence) + 100)) x (Wep Power + 2) / 512

Example
Rolf has 12 inherent attack. Random can be 100. Enemy defence is 2. Weapon power is 5.

So-
(((112 x 512) / 110) x 7) / 512
= ((57344 / 110) x 7) / 512
= 521 x 7 / 512
= 7

Weapon + 2 = W
Inherent Power + Random = P
Defence = D

WP/(100 + 5D) good enough...?

112 x 7 / 110 = 56 x 7 / 55

Guns

39A7F4 - Let R6 be a datastore pointer
39A7F6 - Load datastore/0 (RN) into R0
39A7F8 - Let R1 = 0x0F
39A7FA - AND R1 (mask) over R0 (RN)
39A7FC - Store R0 (masked RN) at datastore/0
39A7FE - Load datastore/0 (masked RN) into R0
39A800 - Add 92 to R0 (masked RN)
39A802 - Store R0 (variance?) at datastore/0
39A804 - Load datastore/0 (variance?) into R5
39A806 - Load datastore/18 (weapon power?) into R0
39A808 - Multiply R5 (variance) into R0 (weapon power)
39A80A - Store R0 (varied WP) at datastore/0
39A80C - Copy R0 (varied WP) into R8
39A80E - Let R1 = 100
39A810 - Jump to 3CDF7C~
39A812 - ~ to take R0 (VWP) % R1 (100)
39A814 - Copy R0 (worthless modulo) to R4
39A816 - Multiply R4 (worthless mod) by 0x10000
39A818 - Copy R8 (???) into R0
39A81A - Let R1 = 100
39A81C - Jump to 3CDF04~
39A81E - ~to divide R1 (100) into R0
39A820 - Let R1 = 0x0000FFFF
39A822 - AND R0 (???) into R1 (mask)
39A824 - OR R1 (damage) into R4 (shifted modulo)
39A826 - Store R4 (damage) at datastore/0
39A828 - Jump to 39A6DC (as done earlier)

39A6DC copied here for easier reference

39A6DC - Let R6 be a datastore pointer
39A6DE - Load datastore/24 (enemy stat base) into R0
39A6E0 - Subtract 3 from R0 (enemy stat base) into R1
39A6E2 - Load R1/0 (enemy cHP) into R7
39A6E4 - Zero R0
39A6E6 - Copy R0 (zero) into R9
39A6E8 - Load datastore/0 (damage) into R0
39A6EA - Compare R0 (damage) to R7 (enemy cHP)
39A6EC - If R0 (damage) < R7 (enemy cHP), jump to 39A6F2

475953 - knife wattack
3D44AD - bowgun power

Gun Power:
Bow Gun - 5 : 4-5
Sonic Gun - 7 : 6-7
Shotgun - 10/spread 2 : 9-10 (18-20)
Silentshot
Poisonshot - 10 : 9-10
Acidshot - 20 : 18-21 
Cannon - 28 : 25-29
Vulcan - 16/spread 3 : 14-17 (42-51)
Laser Shot - 35 : 32-37
Laser Cannon - 53 : 48-56
Pulse Cannon - 60 : 55-64
Pulse Vulcan - 18/spread 4 : 16-19 (64-76)
Neishot - 100 : 92-107

3988E8 - Jump if non-spread gun

Assume that physical random variance bottoms out at 84 for the moment.

ACCURACY hopefully--
39A4A0 - Let R0 = 0
39A4A2 - Let R1 be a datastore pointer
39A4A4 - Store R0 (???) at datastore/0
39A4A6 - Load datastore/2c (character base) into R0
39A4A8 - Subtract 0x19 from R0 (character base)
39A4AA - Load R0/0 (character dexterity) into R7
39A4AC - Store R7 (character dexterity) at datastore/0
39A4AE - Load datastore/0 (dexterity) into R5
39A4B0 - Multiply R5 (dexterity) by 0x100 into R0
39A4B2 - Store R0 (dexterity+) at datastore/0
39A4B4 - Load datastore/24 (enemy base) into R0
39A4B6 - Subtract 0x15 from R0 (enemy base -> enemy agility)
39A4B8 - Load R0/0 (enemy agility) into R6
39A4BA - Load datastore/0 (dexterity+) into R7
39A4BC - Copy R7 (dexterity+) into R0
39A4BE - Copy R6 (enemy agility) into R1
39A4C0 - Jump to 3CDF7C~
39A4C2 - ~ to take R0 (dex+) % R1 (enemy agil)
39A4C4 - Copy R0 (modulo) into R4
39A4C6 - Multiply R4 (modulo) by 0x10000
39A4C8 - Copy R7 (dex+) into R0
39A4CA - Copy R6 (enemy agil) into R1
39A4CC - Jump to 3CDF04~
39A4CE - ~ to take R0 (dex+) / R1 (enemy agil)
39A4D0 - Let R1 = 0x0000FFFF
39A4D2 - AND R0 (dex+/enemy agil) into R1 (mask)
39A4D4 - OR R1 (masked result) into R4 (shifted modulo)
39A4D6 - Let R2 be a datastore pointer
39A4D8 - Store R4 (results) at datastore/0
39A4DA - Let R3 = 0
39A4DC - Copy R3 (0) into R9
39A4DE - Let R0 = 204
39A4E0 - Store R0 (204) at datastore/8
39A4E2 - Load (half) datastore/0 (results) into R1
39A4E4 - Compare R1 (dividend) to 0x7F
39A4E6 - If R1 > 0x7F, jump to 39A4EC

this is basically asking if Dex is over half the enemy agility

39A4EC - Copy R9 (0) into R5
39A4EE - Compare R5 (0) to 0
39A4F0 - If R5 != 0, jump to 39A50E (only possible if missed 39a4e6's jump?)
39A4F2 - Let R0 = 229
39A4F4 - Let R6 be a datastore pointer
39A4F6 - Store R0 (229) at datastore/8
39A4F8 - Add 154 to R0 (229) (now 383)
39A4FA - Compare R1 (dividend) to R0 (383)
39A4FC - If R1 > R0, jump to 39A502 <superlative hit>
39A4FE - Let R0 = 1
39A500 - Copy R0 (1) into R9

<superlative hit>
39A502 - Copy R9 (0 or 1) into R1
39A504 - Compare R1 to 0
39A506 - If R1 != 0, jump to 39A50E

39A50E - Let R3 be a datastore pointer
39A510 - Load datastore/2C (character data base) into R6
39A512 - Load R6/0 (character flags?) into R7
39A514 - Let R0 = 0x10
39A516 - AND R7 (character flags) into R0 (0x10)
39A518 - Compare R0 (character flag check result) to 0
39A51A - If R0 = 0, jump to 39A522

39A522 - Let R4 be a datastore pointer
39A524 - Load datastore/8 (229 or 204) into R0
39A526 - Multiply R0 (229 or 204) by 0x10000 into R5
39A528 - Copy R5 (shifted 229/204) into R8
39A52A - Copy R0 (229/204) into R5
39A52C - Let R6 = 0
39A52E - Copy R6 (0) into R9
39A530 - Compare R5 (229/204) to 0
39A532 - If R5 = 0, jump to 39A582
39A534 - Load datastore/3C (???) into R0
39A536 - Subtract 1 from R0 (???)
39A538 - Store R0 (???) at datastore/3C
39A53A - Multiply R0 (???) by 4
39A53C - Copy R4 (datastore pointer) into R1
39A53E - Add 0x40 to R4 (datastore pointer)
39A540 - Add R1 (something pointer) into R0 (???)
39A542 - Let R1 be 0x8b7
39A544 - Jump to 39D320~
39A546 - ~get us our random number

39A548 : datastore pointer
39A54C : mask (0x0000FFFF)
39A550 : 0x000008B7

attempt to pick up the threads here
39A554 - Let R0 be a datastore pointer
39A556 - Load datastore/0 (???) into R1
39A558 - Store R1 (???) at datastore/0
39A55A - Load datastore/0 (???) into R1
39A55C - Copy R1 (???) into R5
39A55E - Let R1 = 0
39A560 - Copy R1 (0) into R9
39A562 - Copy R0 (datastore pointer) into R2
39A564 - Load datastore/8 (229/204) into R2
39A566 - Compare R5 (???) to R2 (229/204)
39A568 - If R5 < R2, jump to 39A56E

39A56E - Let R4 be a datastore pointer
39A570 - Load datastore/8 (229/204) into R1
39A572 - Subtract R5 (???) from R0 (229/204) into R5
39A574 - Load L2mask into R0
39A576 - AND R0 (L2Mask) into R5 (cut 229/204)
39A578 - Multiply R5 (cut 229/204) by 0x10000 into R6
39A57A - Copy R6 (shifted cut 229/204) into R8
39A57C - Copy R9 (0) into R0
39A57E - Compare R0 to 0
39A580 - If R0 = 0, jump to 39A59e

39A59E - Let R3 be a datastore pointer
39A5A0 - Jump to 39D456~
39A5A2 - ~I wish I knew why

39A5A4 : datastore pointer
39A5A8 : L2 Mask (0x0000FFFF)

Pick up thread at 39A628 (eerily close to physical damage D:)
39A628 - Let R6 be a datastore pointer
39A62A - Load datastore/3C (??? 0xF9 again if that matters) into R0
39A62C - Subtract 1 from R0 (Dunno)
39A62E - Store R0 (Dunno) at datastore/3C
39A630 - Multiply R0 (Dunno) by 4
39A632 - Let R1 be a datastore pointer
39A634 - Add 0x40 to R1 (datastore pointer)
39A636 - Add R1 (something pointer) into R0 (dunno x4)
39A638 - Let R1 = 0x8BB
39A63A - Jump to 39D320 again~
39A63C - ~we want our damage variance

39A640 : datastore pointer
39A644 : 0x000008bb

picking up the pieces
this has run into the physical attack damage thing at the start of the file

which MEANS that 39D320 is the RNG. Should I see what it does!?!?
no
nonono
not at the moment, anyway

Variance for physical is 84 through 115.

Review the events after having gotten the random number for hitting

39A554 - Let R0 be a datastore pointer
39A556 - Load datastore/0 (RN) into R1 (one byte only, ie RN restricted to 0-255)
39A558 - Store R1 (RN) at datastore/0
39A55A - Load datastore/0 (RN) into R1
39A55C - Copy R1 (RN) into R5
39A55E - Let R1 = 0
39A560 - Copy R1 (0) into R9
39A562 - Copy R0 (datastore pointer) into R2
39A564 - Load datastore/8 (229/204) into R2
39A566 - Compare R5 (RN) to R2 (229/204)
39A568 - If R5 < R2, jump to 39A56E <a hit?>
39A56A - Let R3 = 0x01
39A56C - Copy R3 (1) into R9

<a hit?>
39A56E - Let R4 be a datastore pointer
39A570 - Load datastore/8 (229/204) into R1
39A572 - Subtract R5 (RN) from R0 (229/204) into R5
39A574 - Load L2mask into R0
39A576 - AND R0 (L2Mask) into R5 (cut 229/204)
39A578 - Multiply R5 (cut 229/204) by 0x10000 into R6
39A57A - Copy R6 (shifted cut 229/204) into R8
39A57C - Copy R9 (0) into R0
39A57E - Compare R0 to 0
39A580 - If R0 = 0, jump to 39A59e <summat>
39A582 - Let R1 be a datastore pointer
39A584 - Load datastore/28 (???) into R0
39A586 - Subtract 3 from R0 (???) into R6
39A588 - Load R6/0 (???) into R7
39A58A - Let R0 = 0x10
39A58C - OR R7 (???) into R0 (0x10)
39A58E - Store R0 (???) at R6 (20016fc)
39A590 - Let R0 = 1
39A592 - Let R0 = -R0
39A594 - Store R0 (-1) at datastore/0
39A596 - Copy R0 (-1) to R8
39A598 - Copy R8 (-1) to R5
39A59A - Let R2 = 0
39A59C - Copy R2 (0) into R9

<summat>
39A59E - Let R3 be a datastore pointer
39A5A0 - Jump to 39D456~
39A5A2 - ~end of function? considering what happens if you miss, probably

Repeat pre-random number accuracy code and fill in holes. I'm liking the slot theory, let's see if we can't concrete it.

39A4CC - Jump to 3CDF04~
39A4CE - ~ to take R0 (dex+) / R1 (enemy agil)
39A4D0 - Let R1 = 0x0000FFFF
39A4D2 - AND R0 (dex+/enemy agil) into R1 (mask)
39A4D4 - OR R1 (masked result) into R4 (shifted modulo)
39A4D6 - Let R2 be a datastore pointer
39A4D8 - Store R4 (results) at datastore/0
39A4DA - Let R3 = 0
39A4DC - Copy R3 (0) into R9
39A4DE - Let R0 = 204
39A4E0 - Store R0 (204) at datastore/8
39A4E2 - Load (half) datastore/0 (results) into R1
39A4E4 - Compare R1 (dividend) to 0x7F
39A4E6 - If R1 > 0x7F, jump to 39A4EC <Dex isn't failure (> 0.5x agi)>
39A4E8 - Let R4 = 1
39A4EA - Copy R4 (1) into R9

<Dex isn't failure (> 0.5x agi)>
39A4EC - Copy R9 (Dex is failure?) into R5
39A4EE - Compare R5 (Dex is failure?) to 0
39A4F0 - If R5 (Dex is failure?) is true, jump to 39A50E <No more dex boosts>
39A4F2 - Let R0 = 229
39A4F4 - Let R6 be a datastore pointer
39A4F6 - Store R0 (229) at datastore/8
39A4F8 - Add 154 to R0 (229) (now 0x17F)
39A4FA - Compare R1 (dividend) to R0 (0x17F)
39A4FC - If R1 > R0, jump to 39A502 <superlative hit, >1.5x Agi>
39A4FE - Let R0 = 1
39A500 - Copy R0 (1) into R9 (Dex is average?)

<superlative hit, >1.5x Agi>
39A502 - Copy R9 (Dex is average?) into R1
39A504 - Compare R1 (Dex is average?) to 0
39A506 - If R1 (Dex is average?) is true, jump to 39A50E <No more dex boosts>
39A508 - Let R0 = 255
39A50A - Let R2 be a datastore pointer
39A50C - Store R0 (255) at datastore/8

<No more dex boosts>
39A50E - Let R3 be a datastore pointer
39A510 - Load datastore/2C (character base) into R6
39A512 - Load R6/0 (character flags) into R7
39A514 - Let R0 = 0x10
39A516 - AND R7 (character flags) into R0 (0x10)
39A518 - Compare R0 (character has flag?) to 0
39A51A - If R0 (character has flag?) is false, jump to 39A522 <Character not have flag>
39A51C - Load datastore/8 (hit rate) into R0
39A51E - Divide R0 (hit rate) by 2
39A520 - Store R0 (hit rate) at datastore/8

<Character not have flag>
39A522 - Let R4 be a datastore pointer
39A524 - Load datastore/8 (229 or 204) into R0
39A526 - Multiply R0 (229 or 204) by 0x10000 into R5
39A528 - Copy R5 (shifted 229/204) into R8
39A52A - Copy R0 (229/204) into R5
39A52C - Let R6 = 0
39A52E - Copy R6 (0) into R9
39A530 - Compare R5 (229/204) to 0
39A532 - If R5 = 0, jump to 39A582
39A534 - Load datastore/3C (???) into R0
39A536 - Subtract 1 from R0 (???)
39A538 - Store R0 (???) at datastore/3C
39A53A - Multiply R0 (???) by 4
39A53C - Copy R4 (datastore pointer) into R1
39A53E - Add 0x40 to R4 (datastore pointer)
39A540 - Add R1 (something pointer) into R0 (???)
39A542 - Let R1 be 0x8b7
39A544 - Jump to 39D320~
39A546 - ~get us our random number

MAGIC POWER

39A7A4 - Let R3 be a datastore pointer
39A7A6 - Load datastore/3C (???) into R0
39A7A8 - Subtract 1 from R0 (???)
39A7AA - Store R0 (???) at datastore/3C
39A7AC - Multiply R0 (???) by 4
39A7AE - 	Copy R3 (datastore pointer) into R1
39A7B0 - Add 0x40 to R1
39A7B2 - Add R1 (something pointer) into R0 (???)
39A7B4 - Let R1 = 0x8BE
39A7B6 - Jump to 39D320~
39A7B8 - ~to get our randomness

39A7BA : ??
39A7BC : datastore pointer
39A7C0 : 0x000008BE

39A7C4 - Let R6 be a datastore pointer
39A7C6 - Load datastore/0 (RN) into R0
39A7C8 - Let R1 = 0x1F
39A7CA - AND R1 (mask) into R0 (RN)
39A7CC - Store R0 (RN) at datastore/0
39A7CE - Load datastore/0 (RN) into R0
39A7D0 - Add 84 to R0 (RN)
39A7D2 - Jump to 39A802~
39A7D4 - ~continue the same as Gun damage except with the larger variance

So Magic Power has Variance of 84 - 115 (like physicals)

Intermission for post-accuracy

39D456 - Load datastore/3C (F-thing) into R0
39D458 - Multiple R0 (F-thing) by 4 into R1
39D45A - Copy R3 (datastorepointer) into R2
39D45C - Add 0x40 to R2
39D45E - Add R2 (edited pointer) into R1 (4x F-thing)
39D460 - Load R1/1 (something) into R4
39D462 - Add 1 to R0 (F-thing)
39D464 - Store R0 (F-thing) at datastore/3C
39D466 - Jump to 39D628

39D628 - Let R0 =  0xFFFFFC00
39D62A - AND R4 (???) into R0 (mask)
39D62C - Let R1 = 0x80
39D62E - Multipy R1 by 0x10
39D630 - Compare R1 (0x800) to R0 (masked ???)
39D632 - If R1 != R0, jump to 39D638
39D634 - Jump to 39798e~
39D636 - ~what for you may ask, I don't know either

39D65C : 0xFFFFFC00

39798E - Copy R4 (???) into R0
397990 - Compare R4 to 0
397992 - If R4 > 0, jump to 397998

397998 - Divide R0 by 0x400
39799A - Multiply R0 by 0x400
39799C - Subtract R0 (floored ???) from R4 (???) into R0
39799E - Subtract 1 from R0 (???-) into R1
3979A0 - Let R0 = 0xA7
3979A2 - Multiply R0 by 2
3979A4 - Compare R1 (???-) to R0 (0x14e)
3979A6 - If R1 < R0, jump to 3979AC

3979AC - Multiply R1 (???-) by 4 into R0
3979AE - Let R1 = 083979CC
3979B0 - Add R1 (pointer) into R0 (???-)
3979B2 - Load R0/0 (???) into R0
3979B4 - Jump to R0

3979C8 : 0x083979CC

<we came here on knife physical>
398758 - Copy R8 (???) into R2
39875A - Compare R2 to 0
39875C - If R2 < 0, jump to 398780
39875E - Let R2 be a datastore pointer
398760 - Load datastore/3C (F-thing) into R0
398762 - Subtract 1 from R0 (F-thing)
398764 - Store R0 at datastore/3C
398766 - Multiply R0 by 4
398768 - Copy R2 (datastore pointer) into R1
39876A - Add 0x40 to R1 (datastore pointer)
39876C - Add R1 (some pointer) into R0 (4x fthing)
39876E - Load 0x0000080A into R1
398770 - Store R1 at R0/0
398772 - Jump to 39A628~
398774 - ~this is the physical damage function

398778 : datastore pointer
39877c : 0x0000080A

<we came here on nafoi>
398FBC - Copy R8 (???) into R3
398FBE - Compare R3 to 0
398FC0 - If R3 < 0, jump to 398FE4
398FC2 - Let R2 be a datastore pointer
398FC4 - Load datastore/3C (fthing) into R0
398FC6 - Subtract 1 from R0 (fthing)
398FC8 - Store R0 (fthing) at datastore/3C
398FCA - Multiply R0 (fthing) by 4
398FCC - Copy R2 (dsp) into R1
398FCE - Add 0x40 to R1
398FD0 - Add R1 (pointer) into R0 (4xfthing)
398FD2 - Let R1 = 0x00000833
398FD4 - Store R1 (0x833) at R0/0 (some stack)
398FD6 - Jump to 39A7A4~
398FD8 - ~this is the spell damage function

398FDC : datastore pointer
398FE0 : 0x00000833

<we came here on megid>
3991A8 - Copy R8 (???) into R2
3991AA - Compare R2 to 0
3991AC - If R2 < 0, jump to 3991D0
3991AE - Let R2 be a datastore pointer
3991B0 - Load datastore/3C (fthing) into R0
3991B2 - Subtract 1 from R0 (fthing)
3991B4 - Store R0 at datastore/3C
3991B6 - Multiply R0 by 4
3991B8 - Copy R2 (datastore pointer) into R1
3991BA - Add 0x40 to R1 (datastore pointer)
3991BC - Add R1 (some pointer) into R0 (4xfthing)
3991BE - Load 0x00000848 into R1
3991C0 - Store R1 at R0/0
3991C2 - Jump to 39A7A4~
3991C4 - ~this is the spell damage function

<we came here on rimet>
399E10 - Let R0 = 0x020033F0
399E12 - Load R0/0 (???) into R7
399E14 - Subtract 1 from R7 (???) into R5
399E16 - Let R0 be an L2 Mask
399E18 - AND R0 (L2 Mask) into R5 (???)
399E1A - Compare R5 to 0
399E1C - If R5 != 0, jump to 399EA0
399E1E - Let R0 be a datastore pointer
399E20 - Load datastore/4 into R5
399E22 - Let R6 = 0x02002198
399E24 - Load R6/0 into R7
399E26 - Store R7 at datastore/4
399E28 - Load datastore/2C (character base) into R1
399E2A - Subtract 7 from R1 (character base) into R3 (character cTP)
399E2C - Load R3/0 (character cTP) into R7
399E2E - Load datastore/4 (TP cost) into R1
399E30 - Let R4 be a datastore pointer
399E32 - Load datastore/4 into R0
399E34 - Subtract R0 (TP cost) from R7 (character cTP)
399E36 - Store R7 (new cTP) at R3/0 (character cTP)
399E38 - Load R3/0 (character cTP) into R7
399E3A - Store R7 (new cTP) at datastore/8
399E3C - Load datastore/8 (new cTP) into R0
399E3E - Copy R0 into R5
399E40 - Let R6 = 0
399E42 - Copy R6 into R9
399E44 - Load datastore/4 (TP cost) into R0
399E46 - Compare R0 (TP cost) to R5 (new cTP)
399E48 - If R0 < R5, jump to 399E4E

399E4E - Subtract R0 (TP cost) from R5 (new cTP)
399E50 - Let R2 be a datastore pointer
399E52 - Store R0 (newer cTP) at datastore/8
399E54 - Copy R9 (flag) into R3
399E56 - Compare R3 to 0
399E58 - If flag unset, jump to 399EA0

399E88 : 0x020033F0
399E8C : L2 Mask
399E90 : datastore pointer
399E92 : 0x02002198

399EA0 - Let R1 be a datastore pointer
399EA2 - Load datastore/38 (magic data pointer) into R6
399EA4 - Load R6/0 (magic ???) into R7
399EA6 - Let R6 = 0x020009BD
399EA8 - Store R7 (magic ???) at R6/0
399EAA - Let R0 = 0
399EAC - Copy R0 into R9
399EAE - Load datastore/38 (magic data pointer) into R0
399EB0 - Subtract 1 from R0
399EB2 - Store R0 (magic data pointer) at datastore/38
399EB4 - Load R0/0 (magic ???) into R7
399EB6 - Store R7 at datastore/0
399EB8 - Load datastore/0 (magic ???) into R2
399EBA - Copy 0x7F into R0
399EBC - AND R2 (magic ???) into R0 (0x7F)
399EBE - Store R0 at datastore/0
399EC0 - Load datastore/0 into R0
399EC2 - Multiply R0 by 0x10000 into R2
399EC4 - Copy R2 into R8
399EC6 - Copy R0 into R5
399EC8 - Load datastore/3C into R0
399ECA - Subtract 1 from R0
399ECC - Store R0 at datastore/3C
399ECE - Multiply R0 by 4
399ED0 - Add 0x40 to R1 (dsp)
399ED2 - Add R1 into R0
399ED4 - Let R1 = 0x0000088e
399ED6 - Store R1 at R0/0
399ED8 - Let R4 = 0x00009c11
399EDA - Jump to 39D628~
399EDC - ~this is back near the start of the current function -_-

399EE0 : datastore pointer
399EE4 : 0x020009BD
399EE8 : 0x0000088E
399EEC : 0x00009C11

39A36C - 

Magic Attributes
80 - 
40 - Works on Mechanical
20 - Works on Biological
10 -
08 - 
04 - Alltarget
02 - Grouptarget
01 - Singletarget

COLLECTING MAGIC POWER

398D5E - Subtract 1 from R6 (magic data pointer) into R0
398D60 - Store R0 (magic data pointer) at datastore/38
398D62 - Let R0 = 0x01100000 (mech/bio)
398D64 - AND R7 (magic attributes) into R0 (mech/bio mask)
398D66 - Store R0 (mech/bio properties) at datastore/0
398D68 - Load datastore/0 (mech/bio properties) into R5
398D6A - Let R6 = 0x020008C5
398D6C - Store R5 (mech/bio properties) at R6/0 (RAM)
398D6E - Store R2 (magic date base pointer) at datastore/18
398D70 - Load datastore/38 (magic data pointer) into R6
398D72 - Load R6/0 (magic power) into R7
398D74 - Store R7 (magic power) at datastore/18
398D76 - Load datastore/18 (magic power) into R0
398D78 - Copy R0 (magic power) into R5
398D7A - Add 1 to R5 (magic power) into R0
398D7C - Let R1 = 0xFF
398D7E - AND R1 (0xFF) into R0 (magic power + 1)
398D80 - Compare R0 (magic power + 1) to 0
398D82 - If R0 != 0, jump to 398D8C <not ID>

<not ID>
398D8C - Let R2 = 0xFFF5C844
398D8E - Add R10 (data base pointer) into R2 (some offset)
398D90 - Let R6 be a datastore pointer
398D92 - Load datastore/c (???) into R0
398D94 - Store R0 (???) at datastore/0
398D96 - Load datastore/0 (???) into R5
398D98 - Load datastore/20 (???) into R1
398D9A - Copy R1 (???) into R0
398D9C - Subtract 0x57 from R0
398D9E - Store R5 (???) at R0/0
398DA0 - Load datastore/0 (???) into R5
398DA2 - Multiply R5 (???) by 4 into R0
398DA4 - Add R5 (???) into R0 (4x???)
398DA6 - Multiply R0 (5x???) by 2
398DA8 - Store R0 at datastore/0
398DAA - Let R3 = 0
398DAC - Load datastore/R3 into R0
398DAE - Subtract R0 (???) from R2 (some pointer)
398DB0 - Store R2 (some pointer) at datastore/38
398DB2 - Let R7 = 0x0A
398DB4 - Subtract 0x17 from R1 (???)
398DB6 - Store R7 (0x0A) at R1/0
398DB8 - Let R0 = 0x020033F0
398DBA - Load R0/0 (???) into R7
398DBC - Subtract 1 from R7 (???) into R0
398DBE - Load L2 Mask into R1
398DC0 - AND R1 (L2 Mask) into R0 (???)
398DC2 - Compare R0 (masked ???) to 0
398DC4 - If R0 != 0, jump to 398DF0
398DC6 - Let R4 be a datastore pointer
398DC8 - Load datastore/2C (character data base) into R0
398DCA - Subtract 0x7 from R0 (character data base) (now char cTP)
398DCC - Load R0/0 (char cTP) into R7
398DCE - Store R7 (char cTP) at datastore/8
398DD0 - Load datastore/8 (char cTP) into R0
398DD2 - Copy R0 (char cTP) into R5
398DD4 - Let R6 = 0
398DD6 - Copy R6 (0) into R9
398DD8 - Load datastore/4 (TP cost) into R0
398DDA - Compare R0 (TP cost) to R5 (char cTP)
398DDC - If R0 < R5, jump to 398DE2 <enough TP>

<enough TP>
398DE2 - Subtract R0 (TP cost) from R5 (char cTP) into R0
398DE4 - Let R2 be a datastore pointer
398DE6 - Store R0 (new cTP) at datastore/8
398DE8 - Copy R9 (not enough TP?) into R3
398DEA - Compare R3 (not enough TP?) with 0
398DEA - If R3 = 0 (enough TP), jump to 398DF0 <pay TP cost?>

<pay TP cost?>
398DF0 - Let R0 = 0
398DF2 - Let R4 be a datastore pointer
398DF4 - Store R0 (0) at datastore/8
398DF6 - Load datastore/38 (some pointer) into R6
398DF8 - Load R6/0 (accuracy) into R7
398DFA - Store R7 (accuracy) at datastore/8
398DFC - Subtract 1 from R6 (some pointer) into R0
398DFE - Store R0 at datastore/38
398E00 - Load datastore/c (?) into R0
398E02 - Store R0 (?) at datastore/0
398E04 - Load datastore/8 (???) into R5
398E06 - Multiply R5 (???) by 4 into R0
398E08 - Store R0 (4x???) at datastore/0
398E0A - Load datastore/0 into R5
398E0C - Let R0 = 0xFC
398E0E - AND R5 (???) into R0
398E10 - Store R0 (???) at datastore/0
398E12 - Load datastore/0 into R5
398E14 - Divide R5 by 4 into R0
398E16 - Subtract 1 from R0
398E18 - Compare R0 (???) to 0x33
398E1A - If R0 < 0x33, jump to 398E1E

398E1E - Multiply R0 (???) by 4
398E20 - Let R1 = 08398E50
398E22 - Add R1 into R0
398E24 - Load R0/0 into R0
398E26 - Jump to R0

398E28 : datastore pointer
398E3C : 0x020008c5
398E40 : 0xFFF5C844
398E44 : 0x020033F0
398E48 : L2 Mask (0x0000FFFF)
398E4C : 0x08398E50

<nafoi only?>
398F54 - Let R2 be a datastore pointer
398F56 - Load datastore/3C (fthing) into R0
398F58 - Subtract 1 from R0
398F5A - Store R0 at datastore/3C
398F5C - Multiply R0 by 4
398F5E - Copy R2 (datastore pointer) into R1
398F60 - Add 0x40 to R1
398F62 - Add R1 (some pointer) into R0
398F64 - Let R1 = 0x00000831
398F66 - Store R1 at R0/0
398F68 - Jump to 39A34C~
398F6A - ~for an unknown reason which we are going to ignore

398F6C : datastore pointer
398F70 : 0x00000831

398F74 - Let R2 be a datastore pointer
398F76 - Load datastore/28 into R3
398F78 - Copy R3 (some RAM pointer) into R0
398F7A - Subtract 0x0B from R0
398F7C - Load R0/0 into R7
398F7E - Load datastore/20 into R1
398F80 - Copy R1 into R0
398F82 - Subtract 0x0B from R0
398F84 - Store R7 at R0/0
398F86 - Load datastore/4 into R0
398F88 - Add 0x08 to R0
398F8A - Store R0 at datastore/4
398F8C - Load datastore/4 into R5
398F8E - Subtract 0x2D from R1
398F90 - Store R5 at R1/0
398F92 - Subtract 3 from R3 into R6
398F94 - Load R6/0 into R7
398F96 - Let R0 = 0x80
398F98 - OR R7 into R0 (0x80)
398F9A - Store R0 at R6/0
398F9C - Load datastore/3C into R0
398F9E - Subtract 1 from R0
398FA0 - Store R0 at datastore/3C
398FA2 - Multiply R0 by 4
398FA4 - Copy R2 (dsp) into R1
398FA6 - Add 0x40 to R1
398FA8 - Add R1 into R0
398FAA - Let R1 = 0x00000832
398FAC - Store R1 at R0/0
398FAE - jump to 39A5AC~
398FB0 - ~will this be more fruitful?

398FB4 : datastore pointer
398FB8 : 0x00000832

39A5AC - Let R0 = 0x020034E6
39A5AE - Let R2 = 0x0000FFFF
39A5B0 - Load R0/0 into R5
39A5B2 - Compare R5 to 0
39A5B4 - If R5 != 0, jump to 39A5CA

39A5CA - Let R6 = 0x020008C5
39A5CC - Load R6/0 (mech/bio properties) into R7
39A5CE - Let R0 be a datastore pointer
39A5D0 - Store R7 (mech/bio properties) at datastore/4
39A5D2 - Load datastore/4 (mech/bio properties) into R5
39A5D4 - Load datastore/24 (enemy stat base) into R0
39A5D6 - Subtract 1 from R0 (enemy stat base) into R6
39A5D8 - Load R6/0 (enemy attributes) into R7
39A5DA - AND R7 (enemy attributes) into R5 (mech/bio props)
39A5DC - Let R1 be a datastore pointer
39A5DE - Store R5 (spell effective?) at datastore/4
39A5E0 - Load datastore/4 (spell effective?) into R5
39A5E2 - Compare R5 (spell effective?) with 0
39A5E4 - If R5 != 0 (spell is effective), jump to 39A5F2 <spell effective>

<spell effective>
39A5F2 - Let R4 be a datastore pointer
39A5F4 - Load datastore/2C (character data base) into R6
39A5F6 - Load R6/0 (character statii?) into R7
39A5F8 - Let R0 = 0x08
39A5FA - AND R7 (character statii?) into R0 (0x08)
39A5FC - Compare R0 (is statused?) to 0
39A5FE - If R0 (is statused?) = 0, jump to 39A522 (after Dex Boosts/status area of accuracy) [1031]

39A600 - Load datastore/8 (accuracy) into R0
39A602 - Divide R0 (accuracy) by 2
39A604 - Store R0 (new accuracy) at datastore/8
39A604 - Jump to 39A522 (same entry into accuracy as before)

39A608 : 0x020034E6
39A60C : L2 Mask (0x0000FFFF)
39A610 : datastore pointer
39A61C : 0x020008C5

I need:

Shift/Ner/Saner/Shu/Sashu stat increases
Evasion
Defence
Magic Defence?
Level up?
Turn Order

Shu - Rolf Def 0x124 - 0x138
Shift - Anna I-Atk 0x5C - 0x70 (atk 0xc9 - 0xdd)

So for Shu, Rolf's defence increased from 292 to 312 - stock increase of 20 :?
For Shift, Anna's I-attack increased from 92 to 112 - increase of 20

proportions - 20/292 = 6.8%
20/92 = 21.7%

SaNer - A3 -> AD, 4A -> 54, 7F -> 89
Ner - AD - B7

1, 2, 3, 4, 5, 6

So (Sa)Ner is +10 Agility. Stackable at least 6 times.

I'm banking that they're both flat 20 rises then. Doesn't mean much for attack but maybe a tad more for defence

Rolf base - 02003FFF
Nei base - 02003FBF
Rudo base - 02003F7F
Amy base - 02003F3F
Hugh base - 02003EFF
Anna base - 02003EBF
Kain base - 02003E7F
Shir base - 02003E3F

Enemy 1 base - 02003DFF
Enemy 2 base - 02003DBF
Enemy 3 base - 02003D7F
Enemy 4 base - 02003D3F

State 1 - Defence
State 2 - Deband
State 4 - 
State 8 - 
State 10 - 
State 20 - 
State 40 - Sleep
State 80 - Poison

Enemy
State 1 - 
State 2 - 
State 4 - 
State 8 - Silenced (no techs)
State 10 - Insanity (Forsa) (Insanity = 50% miss chance now!?)
State 20 - 
State 40 - 
State 80 - 

EVASION!?!? no, it's some sort of damage.

39AF8E - Let R1 be an L2 Mask
39AF90 - AND R0 (???) into R1
39AF92 - OR R1 (masked ???) into R7
39AF94 - Store R7 (???) at datastore/0
39AF96 - Copy R8 (enemy attack pointer) into R5
39AF98 - Load R5/0 (enemy attack) into R7
39AF9A - Store R7 (enemy attack) at datastore/4
39AF9C - Load datastore/4 (enemy attack) into R5
39AF9E - Load datastore/0 (???) into R0
39AFA0 - Multiply R5 (enemy attack) into R0 (???)
39AFA2 - Store R0 (power combo) at datastore/0
39AFA4 - Load datastore/0 (power combo) at R0
39AFA6 - Divide R0 (power combo) by 0x100
39AFA8 - Store R0 (damage) at datastore/0
39AFAA - Load datastore/0 (damage) at R0
39AFAC - Multiply R0 (damage) by 0x10000 into R6
39AFAE - Copy R6 (shifted damage) into R8
39AFB0 - Compare R0 (damage) to 0
39AFB2 - If damage = 0, jump to 39AFD6 <no damage>
39AFB4 - Copy R9 (character data base) into R0
39AFB6 - Load R0/0 (character state) into R7
39AFB8 - Let R0 = 0x02
39AFBA - AND R7 (character state) into R0 (0x02)
39AFBC - Compare R0 (character has state 2?) to 0
39AFBE - If character has state 2, jump to 39AFC8 <state 2 have>
39AFC0 - Let R1 = 0x01
39AFC2 - AND R7 (character state) into R0 (0x01)
39AFC4 - Compare R0 (character has state 1?) to 0
39AFC6 - If character hasn't state 1, jump to 39AFFC <relevant stateless>

<state 2 have> (or 1)
39AFC8 - Copy R8 (Shifted Damage) into R1
39AFCA - Divide R1 (Shifted Damage) by 0x20000 into R0
39AFCC - Let R2 be a datastore pointer
39AFCE - Store R0 (Cut Damage) at datastore/0
39AFD0 - Load datastore/0 (Cut Damage) into R5
39AFD2 - Compare R5 (Cut Damage) to 0
39AFD4 - If R5 != 0, jump to 39AFFC <damage still exists>

<no damage>
39AFD6 - Let R0 = 0
39AFD8 - Let R3 be a datastore pointer
39AFDA - Store R0 (0) at datastore/0
39AFDC - Copy R0 (0) into R8
39AFDE - Copy R0 (0) into R9
39AFE0 - Load datastore/28 (???) into R0
39AFE2 - Subtract 3 from R0 (???) into R6
39AFE4 - Load R6/0 (???) into R7
39AFE6 - Let R0 = 0x10
39AFE8 - Copy R7 (???) into R5
39AFEA - AND R0 (0x10) into R5 (???)
39AFEC - OR R0 (0x10) into R7 (???)
39AFEE - Store R7 (???) at R6/0
39AFF0 - Jump to 39D5E8~
39AFF2 - ~doubt we need to know why

39AFF4 - datastore pointer
39AFF8 - L2 Mask

<relevant stateless>
<damage still exists>
39AFFC - Let R4 be a datastore pointer
39AFFE - Load datastore/2C (enemy base) into R6
39B000 - Load R6/0 (enemy state) into R7
39B002 - Let R0 = 0x10
39B004 - AND R7 (enemy state) into R0 (0x10)
39B006 - Compare R0 (enemy has state 10?) to 0
39B008 - If enemy hasn't state 10, jump to 39B058 <enemy not have state 0x10>
39B00A - Load datastore/0 (damage) into R0
39B00C - Store R0 (damage) at datastore/8
39B00E - Load datastore/8 (damage) into R0
39B010 - Multiply R0 (damage) by 0x10000 into R5
39B012 - Copy R5 (shifted damage) into R8
39B014 - Copy R0 (damage) into R5
39B016 - Let R6 = 0
39B018 - Copy R6 (some unset flag) into R9
39B01A - Load datastore/3C (fthing) into R0
39B01C - Subtract 1 from R0 (fthing)
39B01E - Store R0 (fthing) at datastore/3C
39B020 - Multiply R0 (fthing) by 4
39B022 - Copy R4 (dsp) into R1
39B024 - Add 0x40 to R1
39B026 - Add R1 (some pointer) into R0 (some offset)
39B028 - Let R1 = 0x000008DA
39B02A - Jump to 39D320~
39B02C - ~collect a random numbah (returns at 39B038)

39B030 : datastore pointer
39B034 : 0x000008DA

39B038 - Let R0 be a datastore pointer
39B03A - Load datastore/0 (RN) into R1 (one byte, ie: 0-FF restriction)
39B03C - Store R1 (RN) at datastore/0
39B03E - Let R1 = 0
39B040 - Copy R1 (unset flag) into R9
39B042 - Load datastore/0 (RN) into R1
39B044 - Compare R1 (RN) to 0x7F
39B046 - If RN > 0x7f (50% chance), jump to 39B04C

39B04C - Copy R9 (flag) into R3
39B04E - Compare R3 (flag) to 0
39B050 - If R3 unset, jump to 39AFD6 <no damage>

<enemy not have state 0x10>
39B058 - Let R5 be a datastore pointer
39B05A - Load datastore/24 (character data base) into R0
39B05C - Subtract 0x03 from R0 (character data base) into R1 (character cHP)
39B05E - Load R1/0 (character cHP) into R7
39B060 - Let R6 = 0x00
39B062 - Copy R6 (0x00) into R9
39B064 - Load datastore/0 (attack damage?) into R0
39B066 - Compare R0 (damage?) to  R7 (char cHP)
39B068 - If R0 < R7, jump to 39B06E

39B06E - Let R2 be a datastore pointer
39B070 - Load R2/0 (damage?) into R0
39B072 - Subtract R0 (damage) into R7 (char cHP)
39B074 - Multiply R7 (char new cHP) by 0x10000 into R3
39B076 - Copy R3 (shifted new cHP) into R8
39B078 - Let R5 be an L2 Mask
39B07A - AND R7 (new cHP) into R5 (L2 Mask)
39B07C - Store R7 (new cHP) at R1/0 (char cHP)
39B07E - Compare R5 (new cHP) to 0
39B080 - If new cHP = 0, jump to 39B08C
39B082 - Copy R9 (some flag) into R4
39B084 - Check if R4 (some flag) is false
39B086 - If not false, jump to 39B08C
39B088 - Jump to 39CE88~
39B08A - ~don't think we need to follow this up

39B0AC : datastore pointer
39B0B0 : L2 Mask

RIMET paralysation

3995DC - Let R1 be a datastore pointer
3995DE - Load datastore/24 (enemy base) into R0
3995E0 - Subtract 1 from R0 (enemy base) into R6 (enemy attribs)
3995E2 - Load R6/0 (enemy attribs) into R7
3995E4 - Store R7 (enemy attribs) at datastore/0
3995E6 - Load datastore/0 (enemy attribs) into R2
3995E8 - Let R0 = 0x7
3995EA - AND R2 (enemy attribs) into R0 (0x7) (now enemy cur paralysis)
3995EC - Store R0 (cur enemy paral) at datastore/0
3995EE - Load datastore/0 (cur enemy paral) into R5
3995F0 - Compare R5 (cur enemy paral) to 0
3995F2 - If cur enemy paral > 0, jump to 3995FE <already paralyzed>
3995F4 - Copy R1 (dsp) into R4
3995F6 - Load datastore/4 (turns to paralyze) into R0
3995F8 - Let R1 = 0x08 (paralysis trigger)
3995FA - OR R1 (paralysis trigger) into R0 (turns to paralyze)
3995FC - Store R0 (paralysis information) at datastore/4
<already paralyzed>
3995FE - Let R5 be a datastore pointer
399600 - Load datastore/24 (enemy base) into R0
399602 - Subtract 1 from R0 (enemy base) into R6
399604 - Load R6/0 (enemy attribs) into R7
399606 - Load datastore/4 (paralysis information) into R0
399608 - OR R7 (enemy attribs) into R0 (paralysis information)
39960A - Store R0 (new enemy attribs) at R6/0
39960C - Let R7 = 0x0000120C
39960E - Let R0 = 0x020033F2
399610 - Store R7 at R0/0
399612 - Jump to 399CBC

399614 : datastore pointer
399618 : 0x0000120C
39961C : 0x020033F2

This didn't tell us how the length of paralysation is determined >:OOO
Where was datastore/4 set? In 39B7E8

39B7C4 - Let R4 be a datastore pointer
39B7C6 - Load datastore/3C into R0
39B7C8 - Subtract 1 from R0
39B7CA - Store R0 at datastore/3C
39B7CC - Multiply R0 by 4
39B7CE - Copy R4 (dsp) into R1
39B7D0 - Add 0x40 to R1
39B7D2 - Add R1 into R0
39B7D4 - Let R1 = 0x000008F1
39B7D6 - Jump to 39D320~
39B7D8 - ~random number collectin' can be fun

39B7DC : datastore pointer
39B7E0 : 0x000008F1

39B7E4 - Let R1 be a datastore pointer
39B7E6 - Let R0 = 0x01
39B7E8 - Store R0 (1) at datastore/4
39B7EA - Let R5 = 0
39B7EC - Copy R5 into R9
39B7EE - Load datastore/0 (RN) into R2 (00 - FF)
39B7F0 - Compare R2 (RN) to 0x4B
39B7F2 - If RN > 0x4B, jump to 39B7F6
39B7F4 - Copy R0 (1) into R9 (set flag)
39B7F6 - Let R6 be a datastore pointer
39B7F8 - Load datastore/0 (RN) into R1 (00-FF)
39B7FA - Copy R1 (RN) into R5
39B7FC - Subtract 0x4C from R5 (RN)
39B7FE - Let R3 = 0xFF
39B800 - AND R3 (0xFF) into R5 (altered RN)
39B802 - Multiply R5 (altered RN) by 0x1000000 into R0
39B804 - Copy R0 into R8
39B806 - Copy R9 into R4
39B808 - Compare R4 (low RN?) against 0
39B80A - If was low RN, jump to 39B84A <turns counted>
39B80C - Load datastore/4 (turns to paralyze) into R0
39B80E - Add 1 to R0 (turns to paralyze)
39B810 - Store R0 (turns to paralyze) at datastore/4
39B812 - Load datastore/4 (turns to paralyse) into R0
39B814 - Let R5 = 0
39B816 - Copy R5 into R9
39B818 - Compare R2 (RN) to 0x98
39B81A - If RN > 0x98, jump to 39B820

39B820 - Copy R1 (RN) into R5
39B822 - Subtract 0x99 from R5 (RN)
39B824 - AND R3 (0xFF) into R5
39B826 - Multiply R5 (altered RN) by 0x1000000 into R1
39B828 - Copy R1 into R8
39B82A - Copy R9 into R2
39B82C - Compare R2 (mid RN?) to 0
39B82E - If was mid RN, jump to 39B84A <turns counted>
39B830 - Add 1 to R0 (turns to paralyze)
39B832 - Copy R0 (turns to paralyze) into R9
39B834 - Let R1 = 0x80
39B836 - Multiply R1 (0x80) by 0x200
39B838 - Copy R9 (turns to paralyze) into R3
39B83A - AND R1 (0x10000) into R3 (turns to paralyze) (.....)
39B83C - Copy R3 (massacred TTP) into R9
39B83E - Let R4 be a datastore pointer
39B840 - Store R0 (turns to paralyze) at datastore/4
39B842 - Load datastore/4 (turns to paralyze) into R0
39B844 - Multiply R0 (turns to paralyze) by 0x10000 into R5
39B846 - Copy R5 (shifted TTP) into R8
39B848 - Copy R0 (turns to paralyse) into R5
<turns counted>
39B84A - let R6 be a datastore pointer
39B84C - Load datastore/3C into R0
39B84E - Multiply R0 by 4 into R1
39B850 - Copy R6 (dsp) into R2
39B852 - Jump to 39D110~
39B854 - ~whyyyyyyy

39B858 : datastore pointer

Rimit, Rimet, Silentshot all have the same paralysis turn count generation.
Doran & Forsa are both Insanity (50% flat miss)
Shiza and Conte are both Status-8 inducing.

ohx special accuracy set 477B80 - 477B83
Ohx special w/silenced

39B40C - Let R0 be 0x08477BD7
39B40E - Subtract 0x48 from R0
39B410 - Let R1 be a datastore pointer
39B412 - Store R0 at datastore/30
39B414 - Load datastore/24 (character base) into R0
39B416 - Subtract 17 from R0 (character base) (now character luck)
39B418 - Load R0/0 (character luck) into R7
39B41A - Let R2 = 0
39B41C - Copy R2 (0) into R8
39B41E - Store R7 (character luck) at datastore/0
39B420 - Load datastore/0 (character luck) into R5
39B422 - Copy R2 (0) into R9
39B424 - Compare R5 (character luck) to 0
39B426 - If enemy luck == 0, jump to 39B448
39B428 - Load datastore/0 (character luck) into R6
39B42A - Copy R6 (character luck) into R0
39B42C - Let R1 = 0x32
39B42E - Jump to 3CDF7C~
39B430 - ~take character luck % 0x32
39B432 - Copy R0 (mod result) into R4
39B434 - Multiply R4 (mod result) by 0x10000
39B436 - Copy R6 (character luck) into R0
39B438 - Let R1 = 0x32
39B43A - Jump to 3CDF04~
39B43C - ~take character luck / 0x32
39B43E - Let R1 be an L2 Mask
39B440 - AND R0 (div result) into R1 (L2 Mask)
39B442 - OR R1 (div result) into R4 (shifted mod result)
39B444 - Let R3 be a datastore pointer
39B446 - Store R4 (combined results) at datastore/0
39B448 - Let R4 be a datastore pointer
39B44A - Load datastore/0 (div result) into R0
39B44C - Compare R0 (luck/50) to 0x02
39B44E - If luck/50 > 100, jump to 39B454 (I think that it uses 4-byte for luck instead of 2-byte, rendering stupidly high quotients, may be a bug)

39B454 -  Copy R9 (unset flag) into R6
39B456 - Compare R6 (not lucky?) to 0
39B458 - If not lucky, jump to 39B460
39B45A - Let R0 = 3
39B45C - Let R1 be a datastore pointer
39B45E - Store R0 (3) at datastore/0 (div result) (making luck/50 ceiling at 3)
39B460 - Copy R8 into R2
39B462 - Let R3 be a datastore pointer
39B464 - Store R2 at datastore/4
39B466 - Load datastore/2C (enemy base) into R2
39B468 - Copy R2 (enemy base) into R6
39B46A - Subtract 27 from R6 (enemy base)
39B46C - Load R6/0 (enemy something) into R7
39B46E - Store R7 (enemy something) at datastore/4
39B470 - Load datastore/0 (ceilinged div result) into R0
39B472 - Load datastore/4 (enemy something) into R1
39B474 - Add R1 (enemy special base accuracy offset) into R0 (luck result)
39B476 - Store R0 (combined accuracy offset) at datastore/0
39B478 - Let R4 = 0
39B47A - Load datastore/0 (combined accuracy offset) into R1
39B47C - Load datastore/30 (special accuracy base) into R0
39B47E - Subtract R1 (combined accuracy offset) from R0 (special accuracy base)
39B480 - Store R0 (special accuracy pointer) at datastore/30
39B482 - Copy R8 into R5
39B484 - Store R5 at datastore/8
39B486 - Load R0/0 (special accuracy) into R7
39B488 - Store R7 (special accuracy) at datastore/8
39B48A - Load datastore/8 (special accuracy) into R0
39B48C - Multiply R0 (special accuracy) by 0x1000000
39B48E - Copy R0 (shifted SAcc) into R8
39B490 - Let R6 = 0
39B492 - Copy R6 into R9
39B494 - Load R2/0 (enemy attribs) into R5
39B496 - Let R0 = 0x08
39B498 - AND R0 (0x08) into R5 (enemy attribs)
39B49A - Compare R5 (has state 8?) to 0
39B49C - If hasn't state 9, jump to 39B4B6
39B49E - Load datastore/8 (special accuracy) into R0
39B4A0 - Let R1 = 0x01
39B4A2 - Copy R1 (1) into R9 (set flag)
39B4A4 - Copy R9 into R2
39B4A6 - AND R0 (special accuracy) into R2 (0x01)
39B4A8 - Copy R2 into R9
39B4AA - Divide R0 (special accuracy) by 2
39B4AC - Store R0 (special accuracy) at datastore/8
39B4AE - Load datastore/3 (special accuracy) into R0
39B4B0 - Multiple R0 (special accuracy) by 0x10000 into R3
39B4B2 - Copy R3 into r8
39B4B4 - Copy R0 (special accuracy) into R5
39B4B6 - Let R4 be a datastore pointer
39B4B8 - Load datastore/3C into R0
39B4BA - Subtract 1 from R0
39B4BC - Store R0 at datastore/3C
39B4BE - Multiply R0 by 4
39B4C0 - Copy R4 (dsp) into R1
39B4C2 - Add 0x40 to R1
39B4C4 - Add R1 into R0
39B4C6 - Let R1 = 0x000008e2
39B4C8 - Jump to 39D320
39B4CA - ~collect our random number for hitting

39B4CC : 0x08477BD7
39B4D0 : datastore pointer
39B4D4 : L2 Mask
39B4D8 : 0x000008e2

39B4DC - Let R0 be a datastore pointer
39B4DE - Load datastore/0 (RN) into R1 (00-FF)
39B4E0 - Store R1 (RN) datastore/0
39B4E2 - Load datastore/0 (RN) into R1
39B4E4 - Copy R1 (RN) into R5
39B4E6 - Let R6 = 0
39B4E8 - Copy R6 into R9 (unset flag)
39B4EA - Load datastore/8 (accuracy) into R0
39B4EC - Compare R5 (RN) to R0 (accuracy)
39B4EE - If RN < accuracy, jump to 39B4F4
39B4F0 - Let R1 =1
39B4F2 - Copy R1 (1) into R9 (set flag)
39B4F4 - Let R2 be a datastore pointer
39B4F6 - Load datastore/8 (accuracy) into R0
39B4F8 - Subtract R5 (RN) from R0 (accuracy)
39B4FA - Let R0 be an L2 Mask
39B4FC - AND R0 (L2 Mask) into R5 (cut accuracy)
39B4FE - Multiply R5 (cut accuracy) by 0x10000 into R3
39B500 - Copy R3 into R8
39B502 - Compare R5 (cut accuracy) to 0
39B504 - If cut accuracy == 0, jump to 39B510
39B506 - Copy R9 into R4
39B508 - Compare R4 (missed?) to 0
39B50A - If missed? is true, jump to 39B510

39B510 - Let R5 be a datastore pointer
39B512 - Load datastore/28 (??) into R0
39B514 - Subtract 3 from R0 (??) into R6
39B516 - Load R6/0 into R7
39B518 - Let R0 = 0x10
39B51A - OR R0 (0x10) into R7
39B51C - Store R0 (???) at R6/0
39B51E - Let R0 = 1
39B520 - Negate R0
39B522 - Store R0 (-1) at datastore/0
39B524 - Copy R0 (-1) into R8
39B526 - Copy R8 (-1) into R5
39B528 - Jump to 39CE84~
39B52A - ~it won't be happy

39B52C : datastore pointer
39B520 : L2 Mask

Recap on what I need:
Evasion
Defence
Magic Defence?
Level up?
Turn Order

TURN ORDER!?!?

3B3DB6 - Let R1 = 0x02003FFF
3B3DB8 - Let R2 be a datastore pointer
3B3DBA - Store R1 at datastore/28
3B3DBC - Load datastore/24 into R3
3B3DBE - Copy R3 into R12
3B3DC0 - Copy R12 into R0
3B3DC2 - Subtract 1 from R0
3B3DC4 - Load R0/0 into R4
3B3DC6 - Copy R4 into R3
3B3DC8 - Subtract 1 from R0
3B3DCA - Store R0 at datastore/24
3B3DCC - Store R4 at datastore/8
3B3DCE - Multiply R4 by 0x40 into R0
3B3DD0 - Store R0 at datastore/4
3B3DD2 - Let R4 = 4
3B3DD4 - Load datastore/R4 into R0
3B3DD6 - Subtract R0 into R1 (character data base)
3B3DD8 - Store R1 at datastore/28
3B3DDA - Subtract 3 from R1 (character data base)
3B3DDC - Load R1/0 (character cHP) into R5
3B3DDE - Compare R5 to 0
3B3DE0 - If cHP = 0, jump to 3B3E84
3B3DE2 - Let R1 = 0x020033EF
3B3DE4 - Let R0 = 0x80
3B3DE6 - Multiply R0 by 0x20
3B3DE8 - AND R3 into R0
3B3DEA - Multiply R0 by 0x10000
3B3DEC - Divide R0 by 0x10000 into R7
3B3DEE - Multiply R3 by 0x10 into R0
3B3DF0 - Store R0 at datastore/4
3B3DF2 - Load datastore/4 into R6
3B3DF4 - Multiply R6 by 0x10000
3B3DF6 - Load datastore/4 into R5
3B3DF8 - Let R3 = 0x4
3B3DFA - Load datastore/R3 into R0
3B3DFC - Subtract R0 into R1
3B3DFE - Store R1 at datastore/34
3B3E00 - Load datastore/3C into R0
3B3E02 - Subtract 1 from R0
3B3E04 - Store R0 at datastore/3C
3B3E06 - Multiply R0 by 4
3B3E08 - Copy R2 (dsp) into R1
3B3E0A - Add 0x40 to R1
3B3E0C - Add R1 into R0
3B3E0E - Let R1 = 0x0000bc18
3B3E10 - Jump to 3B4CBA~
3B3E12 - ~don't know when I'll be back again

3B3E18 : datastore pointer
3B3E24 : 0x02003FFF
3B3E28 : 0x020033EF
3B3E2C : 0x0000BC18

3B3E30 - Let R2 be a datastore pointer
3B3E32 - Load datastore/0 (RN) into R1
3B3E34 - Let R0 = 0xF
3B3E36 - AND R0 (0xF) into R1 (RN) (restricting to 0-F)
3B3E38 - Store R1 (RN) at datastore/0
3B3E3A - Load datastore/28 (character data base) into R0
3B3E3C - Subtract 0x15 from R0 (character data base) (character agility)
3B3E3E - Load R0/0 (character agility) into R4
3B3E40 - Add R4 (character agility) into R1 (RN)
3B3E42 - Store R1 (turn speed) at datastore/0
3B3E44 - Load datastore/20 (some pointer) into R4
3B3E46 - Copy R4 into R12
3B3E48 - Load datastore/8 into R1
3B3E4A - Copy R12 (some pointer) into R0
3B3E4C - Subtract 1 from R0
3B3E4E - Store R1 at R0/0
3B3E50 - Load datastore/20 into R0
3B3E52 - Subtract 2 from R0 into R1
3B3E54 - Store R1 at datastore/20
3B3E56 - Load datastore/0 (turn speed) into R1
3B3E58 - Subtract 3 from R0
3B3E5A - Store R1 (turn speed) at R0/0
3B3E5C - Load datastore/20 into R3
3B3E5E - Subtract 2 from R3 into R0
3B3E60 - Store R0 at datastore/20
3B3E62 - Load datastore/34 into R0
3B3E64 - Subtract 1 from R0
3B3E66 - Load R0/0 into R5
3B3E68 - Compare R5 to 0
3B3E6A - If R5 != 0, jump to 3B3E84
3B3E6C - Load datastore/8 into R1
3B3E6E - Subtract 3 from R3 into R0
3B3E70 - Store R1 at R0/0
3B3E72 - Load datastore/20 into R0
3B3E74 - Subtract 2 from R0 into R1
3B3E76 - Store R1 at datastore/20
3B3E78 - Load datastore/0 (turn speed) into R1
3B3E7A - Subtract 3 from R0
3B3E7C - Store R1 (turn speed) at R0/0
3B3E7E - Load datastore/20 into R0
3B3E80 - Subtract 2 from R0
3B3E82 - Store R0 at datastore/20
3B3E84 - Let R1 be a datastore pointer
3B3E86 - Load datastore/C into R0
3B3E88 - Subtract 1 from R0
3B3E8A - Store R0 at datastore/C
3B3E8C - Load datastore/C into R1
3B3E8E - Let R0 = -1
3B3E90 - Compare R1 to R0
3B3E92 - If R1 != -1, jump to 3B3DB6

3B3EE4 : datastore pointer
3B3EE8 : 0x0000FFFF

remember 0200335B
also 02003358

EVASION ATTEMPT 2
-> Apparently this is TARGETTING instead. Thhhhh.

39B0B4 - Let R3 be a datastore pointer
39B0B6 - Load datastore/3C into R0
39B0B8 - Subtract 1 from R0
39B0BA - Store R0 at datastore/3C
39B0BC - Multiply R0 by 4
39B0BE - Copy R3 (dsp) into R1
39B0C0 - Add 0x40 to R1
39B0C2 - Add R1 into R0
39B0C4 - Let R1 = 0x000008DC
39B0C6 - Jump to 39D320~
39B0C8 - ~random numbers for the taking, but what the heck for?

39B0CC : datastore pointer
39B0D0 : 0x000008DC

39B0D4 - Let R2 be a datastore pointer
39B0D6 - Load datastore/0 (RN) into R1
39B0D8 - Let R0 = 0x07
39B0DA - AND R1 (RN) into R0 (0x07) (restrict RN to 0-7)
39B0DC - Store R0 (RN) at datastore/0
39B0DE - Let R4 = 0
39B0E0 - Copy R4 into R9 (R9 is once again some sort of flag)
39B0E2 - Let R0 = data base pointer
39B0E4 - Subtract 0x40 from R0
39B0E6 - Let R5 = 0
39B0E8 - Load datastore/R5 (RN) into R1
39B0EA - Subtract R1 (RN) into R0 (targetting data base)
39B0EC - Store R0 (target pointer) at datastore/24
39B0EE - Load R0/0 (target) into R7
39B0F0 - Store R7 (target) at datastore/0
39B0F2 - Let R0 = 0x020039FE
39B0F4 - Load R0/0 (chars in party) into R7
39B0F6 - Copy R2 (dsp) into R6
39B0F8 - Load datastore/0 (target) into R6
39B0FA - Compare R7 (chars in party) to R6 (target)
39B0FC - If less chars in party than current target, jump to 39B102
39B0FE - Let R0 = 1
39B100 - Copy R0 into R9 (set flag)
39B102 - Let R1 be a datastore pointer
39B104 - Load datastore/0 (target) into R0
39B106 - Subtract R7 (chars in party) from R0 (target) into R5
39B108 - Let R4 be an L2 Mask
39B10A - AND R4 (L2 Mask) into R5 (subtraction result)
39B10C - Multiply R5 by 0x10000 into R2
39B10E - Copy R2 into R8
39B110 - Compare R5 to 0 (this will be the case if chars in party = target number)
39B112 - If R5 = 0, jump to 39B11A
39B114 - Copy R9 (Valid Target?) into R3
39B116 - Compare R3 to 0
39B118 - If was not valid target, return to start of targetting function
39B11A - Multiply R0 (target) by 2
39B11C - Let R5 be a datastore pointer
39B11E - Store R0 (target x2) at datastore/0
39B120 - Let R6 = 0
39B122 - Load datastore/0 (target x2) into R0
39B124 - Copy negated R0 (target x2) into R6
39B126 - Let R1 = 0x020039F7 (current party list)
39B128 - Add R6 (-target x2) to R1 (current party list) into R0
39B12A - Load R0/0 (targeted character number) into R7
39B12C - Store R7 (targeted character number) at datastore/0
39B12E - Load datastore/0 (targeted character number) into R5
39B130 - Let R2 be a datastore pointer
39B132 - Load datastore/20 (??) into R3
39B134 - Copy R3 (??) into R0
39B136 - Subtract 0x2D from R0
39B138 - Store R5 (targetted character number) at R0/0
39B13A - Let R1 = 0x02003FFF (Rolf's base)
39B13C - Load datastore/0 (targeted character number) into R2
39B13E - Let R5 be a datastore pointer
39B140 - Store R2 (targetted character number) at datastore/4
39B142 - Multiply R2 (targetted character number) by 0x40 into R0
39B144 - Store R0 (targetted character data offset) at datastore/0
39B146 - Let R6 = 0
39B148 - Load datastore/R6 (targetted character data offset) into R0
39B14A - Subtract R0 (targetted character data offset) into R1 (character data base)
39B14C - Store R1 (targetted character data base) at datastore/24
39B14E - Subtract 3 from R1 (targetted character data base)
39B150 - Load R1/0 (character cHP) into R7
39B152 - Multiply R7 (character cHP) by 0x10000 into R0
39B154 - Copy R0 into R8
39B156 - Copy R4 (L2 Mask) into R5
39B158 - AND R7 (character cHP) into R5 (L2 Mask) (remove attribs/status)
39B15A - Let R1 = 0
39B15C - Copy R1 into R9 (new flag!)
39B15E - Compare R5 (character cHP) to 0
39B160 - If character cHP = 0, character is dead. Return to start of Targetting -_-
39B162 - Let R1 = 0x02001BFF
39B164 - Multiply R2 (targetted character number) by 0x80 into R0
39B166 - Let R2 be a datastore pointer
39B168 - Store R0 (some character data offset) at datastore/0
39B16A - Let R4 = 0
39B16C - Load datastore/R4 (some character data offset) into R0
39B16E - Subtract R0 (some character data offset) into R1 (some pointer)
39B170 - Store R1 (some targetted character data) at datastore/28
39B172 - Copy R3 (??) into R0
39B174 - Subtract 0x0B from R0 (??)
39B176 - Load R0/0 (???) into R7
39B178 - Copy R1 into R0
39B17A - Subtract 0x0B from R0
39B17C - Store R7 at R0/0
39B17E - Let R5 = 0
39B180 - Copy R5 into R9 (new flag?)
39B182 - Subtract 3 from R1 into R6
39B184 - Load R6/0 into R7
39B186 - Let R0 = 0x80
39B188 - OR R7 (????) into R0 (0x80)
39B18A - Store R0 (????) at R6/0
39B18C - Load datastore/28 (some targetted character data) into R0
39B18E - Subtract 3 from R0 (some targetted character data) into R6
39B190 - Load R6/0 into R7
39B192 - Let R0 = 0x41
39B194 - Negate R0
39B196 - AND R7 into R0 (some mask)
39B198 - Store R0 at R6/0
39B19A - Load datastore/20 into R0
39B19C - Subtract 0x1B from R0
39B19E - Copy R9 into R6
39B1A0 - Store R6 at R0/0
39B1A2 - Load datastore/4 (targetted character number) into R1
39B1A4 - Let R0 = 0x0200219E
39B1A6 - Store R1 (targetted character number) at R0/0
39B1A8 - Load datastore/4 (targetted character number) into R0
39B1AA - Multiply R0 (targetted character number) by 0x10000 into R1
39B1AC - Copy R1 into R8
39B1AE - Copy R0 into R5
39B1B0 - Let R2 = 0
39B1B2 - Copy R2 into R9
39B1B4 - Let R3 be a datastore pointer
39B1B6 - Jump to 39D5E8~
39B1B8 - ~but whyyyyyyyy

39B1BC : datastore pointer
39B1C0 : data base pointer (0x08477BD7)
39B1C4 : 0x020039FE
39B1C8 : L2 Mask
39B1CC : 0x020039F7
39B1D0 : 0x02003FFF
39B1D4 : 0x02001BFF
39B1D8 : 0x0200219E

This has been a profound disappointment -_- Still...

1 team member - 100%/0%/0%/0%
2 team members - 50%/50%/0%/0%
4 team members - 37.5%/37.5%/12.5%/12.5%

3 is a bit tricksy. Initial stage is 37.5%/37.5%/12.5%, but there's still 12.5% to distribute. 4.6875/4.6875/1.5625/1.5625
-> 42.1875/42.1875/14.0625/ 1.5625 to go
Roughly 43/43/14

EVASION ATTEMPT THREE

39AEF8 - Let R7 = 0x02
39AEFA - Let R1 be a datastore pointer
39AEFC - Load datastore/20 () into R0
39AEFE - Copy R0 into R6
39AF00 - Subtract 0x23 from R6
39AF02 - Store R7 at R6/0
39AF04 - Let R3 = 0
39AF06 - Copy R3 into R9
39AF08 - Subtract 0x1A from R6
39AF0A - Load R6/0 into R7
39AF0C - Let R6 = 0x02002DFB
39AF0E - Store R7 at R6/0
39AF10 - Multiply R7 by 0x1000000 into R4
39AF12 - Copy R4 into R8
39AF14 - Copy R7 into R5
39AF16 - Let R6 be a datastore pointer
39AF18 - Load datastore/3C into R0
39AF1A - Subtract 1 from R0
39AF1C - Store R0 at datastore/3C
39AF1E - Multiply R0 by 4
39AF20 - Copy R6 (dsp) into R1
39AF22 - Add 0x40 to R1
39AF24 - Add R1 into R0
39AF26 - Let R1 = 0x000008D9
39AF28 - Jump to 39D320~
39AF2A - ~hopefully chance of hitting!?!

39AF2C : datastore pointer
39AF30 : 0x02002DFB
39AF34 : 0x000008D9

39AF38 - Let F4 be a datastore pointer
39AF3A - Load datastore/0 (RN) into R0
39AF3C - Let R1 = 0x3F
39AF3E - AND R1 (0x3F) into R0 (RN) (restrict to 0 - 0x3F (0 - 63))
39AF40 - Store R0 (RN) at datastore/0
39AF42 - Load datastore/0 (RN) into R0
39AF44 - Add 0x44 to R0 (RN)
39AF46 - Store R0 (altered RN) at datastore/0
39AF48 - Load datastore/0 (altered RN) into R5
39AF4A - Load datastore/2C (enemy data base) into R0
39AF4C - Copy R0 (enemy data base) into R8
39AF4E - Subtract 0x5C from R1 (0x3F) (now offset)
39AF50 - Add R1 (offset) into R8 (enemy data base) (now enemy attack pointer)
39AF52 - Copy R8 (enemy attack pointer) into R2
39AF54 - Load R2/0 (enemy attack) into R7
39AF56 - Add R7 (enemy attack) to R5 (altered RN) into R0
39AF58 - Store R0 (attack power) at datastore/0
39AF5A - Load datastore/0 (attack power) into R6
39AF5C - Multiply R6 (attack power) by 0x100
39AF5E - Store R6 (attack power x0x100) at datastore/0
39AF60 - Load datastore/24 (character data base) into R3
39AF62 - Copy R3 (character data base) into R9
39AF64 - Copy R9 (character data base) into R0
39AF66 - Subtract 0x1F from R0 (character data base) (now character defence pointer)
39AF68 - Load R0/0 (character defence) into R7
39AF6A - Store R7 (character defence) at datastore/4
39AF6C - Load datastore/4 (character defence) into R5
39AF6E - Multiply R5 (character defence) by 4 into R0
39AF70 - Add R5 (character defence) into R0 (4x character defence)
39AF72 - Store R0 (5x character defence) at datastore/4
39AF74 - Load datastore/4 (5x character defence) into R0
39AF76 - Add 100 to R0 (5x character defence)
39AF78 - Store R0 (buffed defence) at datastore/4
39AF7A - Load datastore/4 (buffed defence) into R5
39AF7C - Copy R6 (attack power x0x100) into R0
39AF7E - Copy R5 (buffed defence) into R1
39AF80 - Jump to 3CDF7C~
39AF82 - ~get R6 % R5 for no good reason
39AF84 - Multiply R0 (remainder) by 0x10000 into R7
39AF86 - Copy R6 (attack power x0x100) into R0
39AF88 - Copy R5 (buffed defence) into R1
39AF8A - Jump to 3CDF04~
39AF8C - ~actually divide this time, coolness
<copy in earlier work and repair>
39AF8E - Let R1 be an L2 Mask
39AF90 - AND R0 (dividend) into R1
39AF92 - OR R1 (dividend) into R7 (remainder)
39AF94 - Store R7 (combined result) at datastore/0
39AF96 - Copy R8 (enemy attack pointer) into R5
39AF98 - Load R5/0 (enemy attack) into R7
39AF9A - Store R7 (enemy attack) at datastore/4
39AF9C - Load datastore/4 (enemy attack) into R5
39AF9E - Load datastore/0 (dividend) into R0
39AFA0 - Multiply R5 (enemy attack) into R0 (dividend)
39AFA2 - Store R0 (power combo) at datastore/0
39AFA4 - Load datastore/0 (power combo) at R0
39AFA6 - Divide R0 (power combo) by 0x100
39AFA8 - Store R0 (damage) at datastore/0
39AFAA - Load datastore/0 (damage) at R0
39AFAC - Multiply R0 (damage) by 0x10000 into R6
39AFAE - Copy R6 (shifted damage) into R8
39AFB0 - Compare R0 (damage) to 0

39AFF4 - datastore pointer

So what do we have here.

((((EA + V) x 512) / (5D + 100)) x EA) / 512

Variance : 68 - 131

E(E + V)/(5D + 100) should be close enough.

STILL NO EVASION SDAFKFLSKDFJAFDASFFSADF :[[[[[[[

Kay 512 agility Rolf just sat through 100-odd attacks without dodging a single one. Evasion = nonexistant = likely.

And again:
Recap on what I need:
Evasion - DONE in a manner of speaking
Defence - DONE
Magic Defence? - Enemies don't exactly use magic, I expect everything hits defence
Level up
Turn Order - I have no wish to look at this

Leaving Levelling Up as the only thing left, unless I want to add some more.

Level Up
	Mental used anywhere aside from Level Up?
Luck used in running?

check for luck being used in running - no
check for AGILITY being used in running - no

meaning no real point to look at running for the moment if ever

Which means - Levelling up.

R0 - character strength pointer
R1 - datastore pointer
R2 - character strength

3B4AA0 - Load datastore/8 (strength up) into R3
3B4AA2 - Add R3 (strength up) and R2 (character strength) into R4
3B4AA4 - Store R4 (new strength) at R0/0
3B4AA6 - Load datastore/28 (some data pointer) into R4
3B4AA8 - Copy R4 (some data pointer) into R12
3B4AAA - Load R4/0 (some data) into R4
3B4AAC - Store R4 (some data) at datastore/8
3B4AAE - Copy R12 (some data pointer) into R0
3B4AB0 - Subtract 1 from R0 (some data pointer)
3B4AB2 - Store R0 (some data pointer) at datastore/28
3B4AB4 - Load datastore/3C into R0
3B4AB6 - NEXT FUNCTION TO CALL SPIEL, SKIPPING (0x0000BC27)
3B4AC4 - Jump to 3B4C9C ~ see you when you get back

3B4AC8 : datastore pointer
3B4ACC : 0x0000BC27

3B4AD0 - Let R1 be a datastore pointer
3B4AD2 - Load datastore/24 (character data base) into R0
3B4AD4 - Subtract 0x13 from R0 (character data base) to (character mental base)
3B4AD6 - Load R0/0 (character mental) into R2
3B4AD8 - Load datastore/8 (mental up) into R3
3B4ADA - Add R3 (mental up) to R2 (character mental) into R4
3B4ADC - Store R4 (new mental) at R0/0 (character mental)
3B4ADE - Load datastore/28 (levelup boosts pointer) into R4
3B4AE0 - Copy R4 into R12
3B4AE2 - Load R4/0 (next levelup boost data) into R4
3B4AE4 - Store R4 at datastore/8
3B4AE6 - Copy R12 (levelup boosts pointer) into R0
3B4AE8 - Subtract 1 from R0
3B4AEA - Store R0 (levelup boosts pointer) at datastore/28
3B4AEC - NEXT FUNCTION TO CALL SPIEL, SKIPPING (0x0000BC28)
3B4AFC - Jump to 3B4C9C ~ maybe I should watch this for a change

3B4B00 : datastore pointer
3B4B04 : 0x0000BC28

3B4C9C - Let R1 be a datastore pointer
3B4C9E - Let R0 = 0x08
3B4CA0 - Load datastore/R0 (next levelup boost) into R0
3B4CA2 - Store R0 (next levelup boost) at datastore/8
3B4CA4 - Load datastore/8 (next levelup boost) into R6
3B4CA6 - Multiply R6 by 0x10000
3B4CA8 - Load datastore/8 (next levelup boost) into R5
3B4CAA - Let R7 = 0
3B4CAC - NEXT FUNCTION TO CALL SPIEL, SKIPPING (0x0000BC30)
3B4CBC - Load 0x00009003 into R1
3B4CBE - Jump to 3B5214~

3B4CC0 : datastore pointer
3B4CC4 : 0x0000BC30
3B4CC8 : 0x00009003

HERE is something more interesting

3B4CCC - Let R2 be a datastore pointer
3B4CCE - Load datastore/0 (RN) into R0 (0 - 0xFF)
3B4CD0 - Add 0x80 to R0 (RN)
3B4CD2 - Store R0 (RN) at datastore/0
3B4CD4 - Load datastore/0 (RN) into R5
3B4CD6 - Load datastore/8 (levelup boost) into R0
3B4CD8 - Multiply R5 (RN) into R0 (levelup boost)
3B4CDA - Store R0 (multiplication) at datastore/8
3B4CDC - Load datastore/8 (multiplication) into R0
3B4CDE - Let R1 = 0x80
3B4CE0 - AND R1 (0x80) into R0 (multiplication)
3B4CE2 - Multiply R0 by 0x10000
3B4CE4 - Divide R0 by 0x10000 into R7
3B4CE6 - Load datastore/8 (multiplication) into R0
3B4CE8 - Divide R0 (multiplication) by 0x100
3B4CEA - Store R0 (new boost) at datastore/8 <-- this is as far as I NEED to go but..
3B4CEC - Load datastore/8 (new boost) into R6
3B4CEE - Multiply R6 by 0x10000
3B4CF0 - Load datastore/8 (new boost) into R5
3B4CF2 - NEXT FUNCTION (0x0000BC28)
3B4D02 - Jump to 3B5214~

3B4D04 : datastore pointer

This implies that levelup boost is given by
(B * V) / 0x100.

V ranges from 80 to 17F... which means that bonuses should range from half-given to 1.5x-given. Allow me to check.
Rudo has 254 STR, and this level he's supposed to get 13. Therefore the minimum should be 6 and the maximum should be 19. GO GO GO 260 CHECK 273 CHECK

HP & TP?

3B49F8 - Compare R5 (new boost) to 0
3B49FA - If new boost = 0, jump to 3B4A0C
3B49FC - Let R4 = 0x00001215
3B49FE - Let R1 be a datastore pointer
3B4A00 - Load datastore/2C into R0
3B4A02 - Subtract 1 from R0
3B4A04 - Store R4 at R0/0
3B4A06 - Load datastore/2C into R0
3B4A08 - Subtract 2 from R0
3B4A0A - Store R0 at datastore/2C
3B4A0C - Let R1 be a datastore pointer
3B4A0E - Load datastore/24 (character data base) into R0
3B4A10 - Subtract 5 from R0 (now character mHP pointer)
3B4A12 - Load R0/0 (character mHP) into R2
3B4A14 - Load datastore/8 (new boost) into R3
3B4A16 - Add R3 (boost) to R2 (cur mHP) into R4
3B4A18 - Store R4 at R0/0
3B4A1A - Load datastore/28 into R4

this is too LATE
we want what DETERMINES it. Can we catch TP?

never mind, it's done statically as well

3B4A40 : datastore pointer