Users browsing this thread: 1 Guest(s)
Boost Atma Weapon
06-17-2020, 08:55 AM
I want to increase the dmg of Atma Weapon, and planning to change the divided damage to 48 or 32, however I just can't understand the bold text below. Its not using hex 40 but something else.
Atma Weapon damage modification
C2/0E39: 08 PHP
C2/0E3A: DA PHX
C2/0E3B: 5A PHY
C2/0E3C: 9B TXY (Y points to attacker)
C2/0E3D: B9 F5 3B LDA $3BF5,Y (HP / 256)
C2/0E40: 1A INC
C2/0E41: EB XBA
C2/0E42: B9 18 3B LDA $3B18,Y (Level)
C2/0E45: 20 81 47 JSR $4781 (Level * ((HP / 256) + 1))
C2/0E48: BE 1D 3C LDX $3C1D,Y (Max HP / 256)
C2/0E4B: E8 INX
C2/0E4C: 20 92 47 JSR $4792 ((Level * ((HP / 256) + 1)) / ((Max HP / 256) + 1))
C2/0E4F: 85 E8 STA $E8 (save modifier quotient)
C2/0E51: C2 20 REP #$20
C2/0E53: A5 F0 LDA $F0 (load damage so far)
C2/0E55: 20 B7 47 JSR $47B7 (24-bit $E8 = modifier in 8-bit $E8 * 16-bit damage)
C2/0E58: A9 05 00 LDA #$0005
C2/0E5B: 20 D1 0D JSR $0DD1 (Divide 24-bit Damage in $E8 by 64. [note that
calculation operates on 4 bytes])
C2/0E5E: 1A INC (+1)
C2/0E5F: 85 F0 STA $F0 (save final damage)
(note that we're assuming damage fit into 16 bits,
which is true outside of hacks that give Atma
Weapon 2-hand or elemental properties.)
C2/0E61: C9 F5 01 CMP #$01F5
C2/0E64: 90 0D BCC $0E73 (branch if < 501)
C2/0E66: A2 5B LDX #$5B (put index for alternate, bigger weapon
graphic, into X)
C2/0E68: C9 E9 03 CMP #$03E9
C2/0E6B: 90 01 BCC $0E6E (branch if < 1001)
C2/0E6D: E8 INX (make graphic bigger yet)
C2/0E6E: 86 B7 STX $B7 (save graphic index)
C2/0E70: 20 BB 35 JSR $35BB (Update a previous entry in ($76) animation buffer
with data in $B4 - $B7) (Changes Atma Weapon length)
C2/0E73: 7A PLY
C2/0E74: FA PLX
C2/0E75: 28 PLP
C2/0E76: 60 RTS
Atma Weapon damage modification
C2/0E39: 08 PHP
C2/0E3A: DA PHX
C2/0E3B: 5A PHY
C2/0E3C: 9B TXY (Y points to attacker)
C2/0E3D: B9 F5 3B LDA $3BF5,Y (HP / 256)
C2/0E40: 1A INC
C2/0E41: EB XBA
C2/0E42: B9 18 3B LDA $3B18,Y (Level)
C2/0E45: 20 81 47 JSR $4781 (Level * ((HP / 256) + 1))
C2/0E48: BE 1D 3C LDX $3C1D,Y (Max HP / 256)
C2/0E4B: E8 INX
C2/0E4C: 20 92 47 JSR $4792 ((Level * ((HP / 256) + 1)) / ((Max HP / 256) + 1))
C2/0E4F: 85 E8 STA $E8 (save modifier quotient)
C2/0E51: C2 20 REP #$20
C2/0E53: A5 F0 LDA $F0 (load damage so far)
C2/0E55: 20 B7 47 JSR $47B7 (24-bit $E8 = modifier in 8-bit $E8 * 16-bit damage)
C2/0E58: A9 05 00 LDA #$0005
C2/0E5B: 20 D1 0D JSR $0DD1 (Divide 24-bit Damage in $E8 by 64. [note that
calculation operates on 4 bytes])
C2/0E5E: 1A INC (+1)
C2/0E5F: 85 F0 STA $F0 (save final damage)
(note that we're assuming damage fit into 16 bits,
which is true outside of hacks that give Atma
Weapon 2-hand or elemental properties.)
C2/0E61: C9 F5 01 CMP #$01F5
C2/0E64: 90 0D BCC $0E73 (branch if < 501)
C2/0E66: A2 5B LDX #$5B (put index for alternate, bigger weapon
graphic, into X)
C2/0E68: C9 E9 03 CMP #$03E9
C2/0E6B: 90 01 BCC $0E6E (branch if < 1001)
C2/0E6D: E8 INX (make graphic bigger yet)
C2/0E6E: 86 B7 STX $B7 (save graphic index)
C2/0E70: 20 BB 35 JSR $35BB (Update a previous entry in ($76) animation buffer
with data in $B4 - $B7) (Changes Atma Weapon length)
C2/0E73: 7A PLY
C2/0E74: FA PLX
C2/0E75: 28 PLP
C2/0E76: 60 RTS
06-17-2020, 12:55 PM
Code:
C2/0E58: A9 05 00 LDA #$0005
C2/0E5B: 20 D1 0D JSR $0DD1 (Divide 24-bit Damage in $E8 by 64. [note that
calculation operates on 4 bytes])
Because A is set to 5 right before the subroutine, the result is 2^6, or division by 64.
You could change LDA #$0005 to #$0004 to make the division 32 instead (doubling the damage), but getting a divisor that isn't a power of two won't be possible with an in-line change.
« Next Oldest | Next Newest »
Users browsing this thread: 1 Guest(s)