Users browsing this thread: 1 Guest(s)
Espers teaching Stat gains
11-12-2020, 03:28 PM
If I understand correctly, I think you can do this with a lookup table. Put your spell index in the accumulator, subtract $25 then transfer to x and load from the lookup table. Your lookup table will be an array of bytes, one for each skill-up value. You can put the table anywhere that you have free space.
Alternatively, if the conversion from spell index to skill-up id is a simple mathematical function (i.e. skill-up = 9 + (spell - $25) * 3) you could write an algorithm to convert it. This might save a few bytes but it won't be as flexible.
Code:
; turn $25 into $09, etc.
sec
sbc #$25
tax
lda lookup_table,x
; somewhere in free space
lookup_table:
.db $09,$09,$09,$0a,$0a,$0a,...
Alternatively, if the conversion from spell index to skill-up id is a simple mathematical function (i.e. skill-up = 9 + (spell - $25) * 3) you could write an algorithm to convert it. This might save a few bytes but it won't be as flexible.
« Next Oldest | Next Newest »
|
||||
Users browsing this thread: 1 Guest(s)