Here's a version that stays 24-bit until the end of the function.
Didn't test it very thoroughly, but it seemed to be working. Let me know if you find any problems.
Moderators: General Moderator, Game Moderator
C2/2C13: 18 CLC
C2/2C14: E6 E8 INC $E8
C2/2C16: 69 00 00 ADC #$0000
INC $E8
BNE skip (branch if bottom word didn't wrap past 65535)
INC (if it did, carry into the the top word)
skip:
Caps damage at 65535 and exits the function
C2/679D: A5 EA LDA $EA (High byte of damage)
C2/679F: 29 FF 00 AND #$00FF (Did damage overflow into 3rd byte?)
C2/67A2: D0 08 BNE $67AC (If so branch)
C2/67A4: A5 E8 LDA $E8 (Lower 2 bytes of damage)
C2/67A6: 80 02 BRA $67AA
C2/67A8: 7B TDC
C2/67A9: 3A DEC (Damage = 0xFFFF)
C2/67AA: 8D B0 11 STA $11B0
C2/67AD: 28 PLP
C2/67AE: 60 RTS (Goodbye)
Caps damage at 65535 and exits the function
C2/679D: A5 EA LDA $EA (High bytes of damage)
C2/679F: C9 01 00 CMP #$0001 (Did damage overflow into 3rd byte?)
C2/67A2: A5 E8 LDA $E8 (Lower 2 bytes of damage)
C2/67A4: 90 02 BCC $67A8 (Branch if damage didn't use top bytes)
C2/67A6: 7B TDC
C2/67A7: 3A DEC (Damage = 0xFFFF)
C2/67A8: 8D B0 11 STA $11B0
C2/67AB: 28 PLP
C2/67AC: 60 RTS (Goodbye)
C2/6796: 08 PHP
C2/6797: A5 EA LDA $EA
C2/6799: 0A ASL
C2/679A: 28 PLP
C2/679B: 80 EB BRA $6788
Multiplies damage by 1.5
LDA $EA
PHA
LSR $EA
LDA $E8
ROR
ADC $E8
STA $E8
PLA
BRA $6788
C2/2C13: AD B0 11 LDA $11B0
C2/2C16: 4A LSR
C2/2C17: 6D B0 11 ADC $11B0
C2/2C1A: 1A INC
C2/2C1B: 6A ROR
C2/2C1C: 8D B0 11 STA $11B0
C2/2C1F: 28 PLP
C2/2C20: 60 RTS
C2/2BDF: EB XBA (Low A = result of second multiply / 256)
C2/2BE0: 48 PHA (Store above result)
C2/2BE1: C2 20 REP #$20 (Set 16-bit Accumulator)
C2/2BE3: A5 E9 LDA $E9 (Get upper two bytes of first multiply)
C2/2BE5: 20 B7 47 JSR $47B7 (Multiply those two bytes by level)
C2/2BE8: C9 00 01 CMP #$0100 (Check for overflow)
C2/2BEB: 68 PLA (Restore result from second multiply)
Return to ROM Hacking and Emulation
Users browsing this forum: No registered users and 3 guests