Get Current ENTD Data Pointer

From Final Fantasy Hacktics Wiki
Revision as of 17:21, 18 May 2024 by Nyzer (talk | contribs) (Created page with "<font face='Courier New'> 00042880: 27bdffe8 addiu r29,r29,0xffe8 00042884: afb00010 sw r16,0x0010(r29) 00042888: 3c108004 lui r16,0x8004 0004288c: 26107600 addiu r16,r1...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

00042880: 27bdffe8 addiu r29,r29,0xffe8
00042884: afb00010 sw r16,0x0010(r29)
00042888: 3c108004 lui r16,0x8004
0004288c: 26107600 addiu r16,r16,0x7600         # 0x80047600 = Seems to be where the current ENTD ID is stored
00042890: afbf0014 sw r31,0x0014(r29)
00042894: 8e020000 lw r2,0x0000(r16)            # r2 = Current ENTD ID
00042898: 00000000 nop
0004289c: 1040001f beq r2,r0,0x0004291c         # Branch to end if ENTD ID = 0
000428a0: 2402ffff addiu r2,r0,0xffff           # r2 = 0xffff (some kind of value to indicate there is no ENTD?)
000428a4: 0c0111b2 jal 0x000446c8               # Check File Still Loading
000428a8: 00000000 nop
000428ac: 1440001b bne r2,r0,0x0004291c         # Branch to end if there was a value (presumably meaning not loaded yet?)
000428b0: 00001021 addu r2,r0,r0                # r2 = 0 (some kind of value to indicate failure to load?)
000428b4: 8e030000 lw r3,0x0000(r16)            # r3 = Current ENTD ID
000428b8: 00000000 nop
000428bc: 28620080 slti r2,r3,0x0080            # r2 = 0x01 if ENTD ID is less than 0x80 (using ENTD 1)
000428c0: 10400007 beq r2,r0,0x000428e0         # Branch if above 0x80
000428c4: 00031080 sll r2,r3,0x02               # r2 = ENTD ID * 4
000428c8: 00431021 addu r2,r2,r3                # -- r2 = ENTD ID * 5
000428cc: 3c038004 lui r3,0x8004
000428d0: 8c637604 lw r3,0x7604(r3)             # -- r3 = Load from 0x80047604. Seems to be the pointer to the start of the current ENTD sector's data
000428d4: 000211c0 sll r2,r2,0x07               # -- r2 = ENTD ID * 0x280
000428d8: 08010a47 j 0x0004291c                 # -- Jump to end
000428dc: 00431021 addu r2,r2,r3                # -- r2 = ENTD encounter tables + ENTD ID * 0x280 = Current ENTD's data
000428e0: 28620100 slti r2,r3,0x0100            # r2 = 0x01 if ENTD ID is less than 0x100 (using ENTD 2)
000428e4: 14400007 bne r2,r0,0x00042904         # Branch if ENTD ID is 0x80-0xFF (ENTD 2)
000428e8: 2462ff80 addiu r2,r3,0xff80           # r2 = ENTD ID - 0x80
000428ec: 28620180 slti r2,r3,0x0180            # -- r2 = 0x01 if ENTD ID is 0x101-0x17F (using ENTD 3)
000428f0: 10400003 beq r2,r0,0x00042900         # -- Branch if ENTD ID is 0x180-0x1FF (using ENTD 4)
000428f4: 00000000 nop
000428f8: 08010a41 j 0x00042904                 # -- -- 
000428fc: 2462ff00 addiu r2,r3,0xff00           # -- -- r2 = ENTD ID - 0x100
00042900: 2462fe80 addiu r2,r3,0xfe80           # -- r2 = ENTD ID - 0x180
00042904: 00021880 sll r3,r2,0x02               # r3 = modified ENTD ID * 4
00042908: 00621821 addu r3,r3,r2                # r3 = modified ENTD ID * 5
0004290c: 3c028004 lui r2,0x8004
00042910: 8c427604 lw r2,0x7604(r2)             # r2 = Current ENTD sector data pointer
00042914: 000319c0 sll r3,r3,0x07               # r3 = modified ENTD ID * 0x280
00042918: 00621021 addu r2,r3,r2                # r2 = Current ENTD data pointer
0004291c: 8fbf0014 lw r31,0x0014(r29)
00042920: 8fb00010 lw r16,0x0010(r29)
00042924: 27bd0018 addiu r29,r29,0x0018
00042928: 03e00008 jr r31
0004292c: 00000000 nop