Difference between revisions of "Load Job Level"

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
(Created page with " 0017ea28: 24a2ffb5 addiu r2,r5,0xffb5 Job ID - 0x4b (Chemist) 0017ea2c: 2c420013 sltiu r2,r2,0x0013 0017ea30: 10400003 beq r2,r0,0x0017ea40 Branch if Job ID isn't generic...")
 
m
Line 1: Line 1:
  0017ea28: 24a2ffb5 addiu r2,r5,0xffb5 Job ID - 0x4b (Chemist)
+
Parameters : r5 = Unit current Job ID (Unit 0x03)
  0017ea2c: 2c420013 sltiu r2,r2,0x0013
+
              r6 = previous routine stack pointer (store job ID if generic)
  0017ea30: 10400003 beq r2,r0,0x0017ea40 Branch if Job ID isn't generic
+
  0017ea34: 24a2ffb6 addiu r2,r5,0xffb6 Job ID - 0x4a (Squire)
+
Returns : r2 = Unit's current job's Lv
  0017ea38: 0805fa91 j 0x0017ea44
+
-----------------------------------------------------------------------------
  0017ea3c: acc20000 sw r2,0x0000(r6) Generic ID = Generic ID (sans squire)
+
  0017ea28: 24a2ffb5 addiu r2,r5,-0x004b      |{{f/std|<nowiki>r2 = Unit's current Job ID - 0x4b</nowiki>}}
  0017ea40: acc00000 sw r0,0x0000(r6) Generic ID = 0 (squire)
+
  0017ea2c: 2c420013 sltiu r2,r2,0x0013       |{{f/std|<nowiki>r2 = 0x01 if job ID < Chocobo (Job is generic)</nowiki>}}
  0017ea44: 8cc30000 lw r3,0x0000(r6) Load Generic Job ID
+
  0017ea30: 10400003 beq r2,r0,0x0017ea40     {{f/Cond|If Job is a generic job}}
  0017ea48: 00000000 nop
+
  0017ea34: 24a2ffb6 addiu r2,r5,-0x004a          |{{f/std|<nowiki>r2 = Job ID - 0x4a (Squire)</nowiki>}}
  0017ea4c: 000317c2 srl r2,r3,0x1f
+
  0017ea38: 0805fa91 j 0x0017ea44                 {{f/jump|jump storing Job ID }}
  0017ea50: 00621021 addu r2,r3,r2
+
  0017ea3c: acc20000 sw r2,0x0000(r6)             |{{f/store|Store Job ID in previous routine stack pointer}}
  0017ea54: 00021043 sra r2,r2,0x01 ID / 2
+
                                            {{f/Cond|Else : Job is not generic}}
  0017ea58: 00821021 addu r2,r4,r2
+
  0017ea40: acc00000 sw r0,0x0000(r6)             |{{f/store|Nullify Job ID on stack}}
  0017ea5c: 30630001 andi r3,r3,0x0001 r3 = ID AND 1
+
  0017ea44: 8cc30000 lw r3,0x0000(r6)         |{{f/adr|<nowiki>r3 = Job ID if generic (else 0x00)</nowiki>}}
  0017ea60: 904200d2 lbu r2,0x00d2(r2) Load Unit's Current Job Level
+
  0017ea48: 00000000 nop                     |
  0017ea64: 14600003 bne r3,r0,0x0017ea74 Branch if Job uses low nybble
+
  0017ea4c: 000317c2 srl r2,r3,0x1f           |{{f/std|highest bit of Job ID (should be 0)}}
  0017ea68: 00000000 nop
+
  0017ea50: 00621021 addu r2,r3,r2           |{{f/std|Job ID + 0}}
  0017ea6c: 0805fa9e j 0x0017ea78
+
  0017ea54: 00021043 sra r2,r2,0x01           |{{f/std|<nowiki>r2 = Job ID / 2 (job offset in unit data)</nowiki>}}
  0017ea70: 00021103 sra r2,r2,0x04 r2 = High nybble Level
+
  0017ea58: 00821021 addu r2,r4,r2           |{{f/std|<nowiki>r2 = Unit pointer + Job offset</nowiki>}}
  0017ea74: 3042000f andi r2,r2,0x000f r2 = Low nybble Level
+
  0017ea5c: 30630001 andi r3,r3,0x0001       |{{f/std|<nowiki>r3 = 0x01 if Job ID is uneven</nowiki>}}
 +
  0017ea60: 904200d2 lbu r2,0x00d2(r2)       |{{f/load|<nowiki>r2 = Unit's Job Lv byte (2 jobs per bytes)</nowiki>}}
 +
  0017ea64: 14600003 bne r3,r0,0x0017ea74     {{f/Cond|If Job ID is an even number}}
 +
  0017ea68: 00000000 nop                         |
 +
  0017ea6c: 0805fa9e j 0x0017ea78                 {{f/jump|jump with higher nibble}}
 +
  0017ea70: 00021103 sra r2,r2,0x04               |{{f/std|<nowiki>r2 = High nybble</nowiki>}}
 +
                                            {{f/Cond|Else : Job is uneven}}
 +
  0017ea74: 3042000f andi r2,r2,0x000f           |{{f/std|<nowiki>r2 = Low nybble</nowiki>}}
 
  0017ea78: 03e00008 jr r31
 
  0017ea78: 03e00008 jr r31
 
  0017ea7c: 00000000 nop
 
  0017ea7c: 00000000 nop
 +
=== Returns locations ===
 +
'''Battle.bin'''
 +
0017e930: [[Gained_JP_Up_Section]]
 +
0017e9e4: [[Gained_JP_Up_Section]]
 +
0018dfd4: [[Prep_gained_exp/jp/level/job_level]]
 +
0018e024: [[Main_Reaction_subroutine_-_ENTD/ID_stuff]]
 +
0018e050: [[Main_Reaction_subroutine_-_ENTD/ID_stuff]]

Revision as of 19:51, 29 June 2022

Parameters : r5 = Unit current Job ID (Unit 0x03)
             r6 = previous routine stack pointer (store job ID if generic)

Returns : r2 = Unit's current job's Lv
-----------------------------------------------------------------------------
0017ea28: 24a2ffb5 addiu r2,r5,-0x004b      |r2 = Unit's current Job ID - 0x4b
0017ea2c: 2c420013 sltiu r2,r2,0x0013       |r2 = 0x01 if job ID < Chocobo (Job is generic)
0017ea30: 10400003 beq r2,r0,0x0017ea40     #If Job is a generic job
0017ea34: 24a2ffb6 addiu r2,r5,-0x004a          |r2 = Job ID - 0x4a (Squire)
0017ea38: 0805fa91 j 0x0017ea44                 >>jump storing Job ID 
0017ea3c: acc20000 sw r2,0x0000(r6)             |Store Job ID in previous routine stack pointer
                                            #Else : Job is not generic
0017ea40: acc00000 sw r0,0x0000(r6)             |Nullify Job ID on stack
0017ea44: 8cc30000 lw r3,0x0000(r6)         |r3 = Job ID if generic (else 0x00)
0017ea48: 00000000 nop                      |
0017ea4c: 000317c2 srl r2,r3,0x1f           |highest bit of Job ID (should be 0)
0017ea50: 00621021 addu r2,r3,r2            |Job ID + 0
0017ea54: 00021043 sra r2,r2,0x01           |r2 = Job ID / 2 (job offset in unit data)
0017ea58: 00821021 addu r2,r4,r2            |r2 = Unit pointer + Job offset
0017ea5c: 30630001 andi r3,r3,0x0001        |r3 = 0x01 if Job ID is uneven
0017ea60: 904200d2 lbu r2,0x00d2(r2)        |r2 = Unit's Job Lv byte (2 jobs per bytes)
0017ea64: 14600003 bne r3,r0,0x0017ea74     #If Job ID is an even number
0017ea68: 00000000 nop                          |
0017ea6c: 0805fa9e j 0x0017ea78                 >>jump with higher nibble
0017ea70: 00021103 sra r2,r2,0x04               |r2 = High nybble
                                            #Else : Job is uneven
0017ea74: 3042000f andi r2,r2,0x000f            |r2 = Low nybble
0017ea78: 03e00008 jr r31
0017ea7c: 00000000 nop

Returns locations

Battle.bin
0017e930: Gained_JP_Up_Section
0017e9e4: Gained_JP_Up_Section
0018dfd4: Prep_gained_exp/jp/level/job_level
0018e024: Main_Reaction_subroutine_-_ENTD/ID_stuff
0018e050: Main_Reaction_subroutine_-_ENTD/ID_stuff