Users browsing this thread: 1 Guest(s)
How Do We Index Address

#7
Posts: 290
Threads: 3
Thanks Received: 40
Thanks Given: 1
Joined: Apr 2012
Reputation: 9
Status
None
What you're likely thinking of is indexed jumping - i.e., JSR $8C4A,X

In this case, $8C4A is generally the start of the jump table. The table itself is simply a list of addresses in little Endian (essentially meaning that you read them backwards) that redirect the jump. So, using the esper bonus jump table for example:

Code:
C2/614E: 70 61  (~10% HP bonus)
C2/6150: 74 61  (~30% HP bonus)
C2/6152: 78 61  (50% HP bonus)
C2/6154: 70 61  (~10% MP bonus)
C2/6156: 74 61  (~30% MP bonus)
C2/6158: 78 61  (50% MP bonus)
C2/615A: B0 61  (Double natural HP gain for level)
C2/615C: 97 61  (No bonus)
C2/615E: 97 61  (No bonus)
C2/6160: 9B 61  (Vigor bonus)
C2/6162: 9B 61  (Vigor bonus)
C2/6164: 9A 61  (Speed bonus)
C2/6166: 9A 61  (Speed bonus)
C2/6168: 99 61  (Stamina bonus)
C2/616A: 99 61  (Stamina bonus)
C2/616C: 98 61  (MagPwr bonus)
C2/616E: 98 61  (MagPwr bonus)

If you look at these backwards, you can see where each one will redirect the jump to. For instance, the HP +50% boost would redirect the jump to C2/6178.

It's important to remember that X needs to be an even number for a jump table to work properly. Since all addresses in a jump table are two bytes, you need to push the index forward by two bytes to get the next proper address in the table. That's why you will see things like ASL, TAX before the jump (like at C2/60EF).


GET A SILK BAG FROM THE GRAVEYARD DUCK TO LIVE LONGER.

Brave New World
  Find
Quote  
[-] The following 1 user says Thank You to Synchysi for this post:
  • ReturnerScum (02-08-2016)



Messages In This Thread
How Do We Index Address - by ReturnerScum - 02-07-2016, 12:33 PM
RE: How Do We Index Address - by Catone - 02-07-2016, 12:52 PM
RE: How Do We Index Address - by ReturnerScum - 02-07-2016, 02:13 PM
RE: How Do We Index Address - by Catone - 02-07-2016, 03:15 PM
RE: How Do We Index Address - by m06 - 02-07-2016, 06:03 PM
RE: How Do We Index Address - by madsiur - 02-08-2016, 12:14 AM
RE: How Do We Index Address - by Synchysi - 02-08-2016, 12:31 AM

Forum Jump:

Users browsing this thread: 1 Guest(s)


Theme by Madsiur2017Custom Graphics by JamesWhite