Created
November 17, 2018 01:15
-
-
Save HS39/a4a80b1142fabd89d0308118cf120f7a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import asm65816 | |
import ASMRef | |
// Code that determines how much HP and PP are gained per stat point on level up | |
ROM[0xC1D617] = { | |
JSL (LevelUp_Vital) | |
BRA_a (0xD639) | |
} | |
ROM[0xC1D6A6] = { | |
JSL (LevelUp_IQ) | |
BRA_a (0xD701) | |
} | |
LevelUp_Vital: { | |
LDY_d (0x1B) | |
TYA | |
LDY_i (0x005F) | |
JSL (Eight_Bit_Mult_YxA) | |
TAX | |
LDA_x (0x99E8) //Total Vitality | |
AND_i (0x00FF) | |
STA_d (0x04) | |
ASL | |
ADC_d (0x04) | |
ASL | |
ADC_d (0x04) | |
ASL | |
ADC_d (0x04) | |
SEC | |
SBC_x (0x99D8) //(Vitality * 15) - maxHP | |
STA_d (0x14) | |
RTL | |
} | |
LevelUp_IQ: { | |
LDY_d (0x1B) | |
CPY_i (0x0002) | |
BNE_a (LevelUp_IQ_1) | |
JMP_l (Jeff_PSI) //Stop if Jeff | |
LevelUp_IQ_1: | |
CPY_i (0x0000) | |
BNE_a (LevelUp_IQ_2) //Branch if not Ness | |
LDA_i (0x004A) | |
JSL (Check_Event) | |
CMP_i (0x0000) | |
BEQ_a (LevelUp_IQ_2) //Branch if haven't finished Magicant | |
LDY_d (0x1B) | |
TYA | |
LDY_i (0x005F) | |
JSL (Eight_Bit_Mult_YxA) | |
TAX | |
LDA_x (0x99E9) | |
AND_i (0x00FF) | |
ASL //IQ * 2 | |
BRA_a (LevelUp_IQ_3) | |
LevelUp_IQ_2: | |
LDY_d (0x1B) | |
TYA | |
LDY_i (0x005F) | |
JSL (Eight_Bit_Mult_YxA) | |
TAX | |
LDA_x (0x99E9) //IQ | |
AND_i (0x00FF) | |
LevelUp_IQ_3: | |
STA_d (0x12) | |
LDY_d (0x1B) | |
TYA | |
LDY_i (0x005F) | |
JSL (Eight_Bit_Mult_YxA) | |
TAX | |
LDA_d (0x12) | |
STA_d (0x04) | |
ASL | |
ASL | |
ADC_d (0x04) //Multiple by 5 | |
SEC | |
SBC_x (0x99DA) //Subtract maximum PP | |
STA_d (0x14) | |
RTL | |
Jeff_PSI: | |
LDA_d (0x1D) | |
BEQ_a (Jeff_Return) | |
JSL (0xC1003C) | |
Jeff_Return: | |
PLD | |
RTL | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment