Added glabels with upper address loaded via li.

This commit is contained in:
Antonio Castelli
2021-05-30 15:41:41 -07:00
parent 22d8de46c8
commit e4707e4598
7 changed files with 12 additions and 17 deletions
@@ -455,7 +455,8 @@ glabel func_800159C8
/* 016C94 80016094 00000000 */ nop
/* 016C98 80016098 45000011 */ bc1f .L800160E0
/* 016C9C 8001609C 00000000 */ nop
/* 016CA0 800160A0 3C01800E */ li $at, 0x800E0000 # -0.000000
# Used to access D_800E55D0 and D_800E55D4.
/* 016CA0 800160A0 3C01800E */ lui $at, %hi(D_800E55D0) # $at, 0x800e
/* 016CA4 800160A4 C486001C */ lwc1 $f6, 0x1c($a0)
/* 016CA8 800160A8 C42155D0 */ lwc1 $f1, %lo(D_800E55D0)($at)
/* 016CAC 800160AC C42055D4 */ lwc1 $f0, %lo(D_800E55D4)($at)
+2
View File
@@ -48,6 +48,8 @@ glabel D_800E9810
.word 0xEEA56814
.word 0x3EC5DBDF
.word 0x0E314BFE
glabel D_800E9838
.word 0x3FD45F30
.word 0x6DC9C883
+1
View File
@@ -7,6 +7,7 @@
.section .rodata
glabel D_800E9640
.word 0x3F91DF46
.word 0x9D353918
.word 0x00000000
@@ -8,8 +8,8 @@ glabel guPerspectiveF
/* 0CD538 800CC938 0C035250 */ jal guMtxIdentF
/* 0CD53C 800CC93C E7AE0038 */ swc1 $f14, 0x38($sp)
/* 0CD540 800CC940 C7AE0038 */ lwc1 $f14, 0x38($sp)
/* 0CD544 800CC944 3C01800F */ li $at, 0x800F0000 # -0.000000
/* 0CD548 800CC948 D4269640 */ ldc1 $f6, -0x69c0($at)
/* 0CD544 800CC944 3C01800F */ lui $at, %hi(D_800E9640) # $at, 0x800f
/* 0CD548 800CC948 D4269640 */ ldc1 $f6, %lo(D_800E9640)($at)
/* 0CD54C 800CC94C 46007121 */ cvt.d.s $f4, $f14
/* 0CD550 800CC950 3C014000 */ li $at, 0x40000000 # 2.000000
/* 0CD554 800CC954 46262202 */ mul.d $f8, $f4, $f6
+2 -2
View File
@@ -39,8 +39,8 @@ glabel sinf
/* 0D58A4 800D4CA4 10200044 */ beqz $at, .L800D4DB8
/* 0D58A8 800D4CA8 C7A40000 */ lwc1 $f4, ($sp)
/* 0D58AC 800D4CAC C7A60000 */ lwc1 $f6, ($sp)
/* 0D58B0 800D4CB0 3C01800F */ li $at, 0x800F0000 # -0.000000
/* 0D58B4 800D4CB4 D42A9838 */ ldc1 $f10, -0x67c8($at)
/* 0D58B0 800D4CB0 3C01800F */ lui $at, %hi(D_800E9838) # $at, 0x800f
/* 0D58B4 800D4CB4 D42A9838 */ ldc1 $f10, %lo(D_800E9838)($at)
/* 0D58B8 800D4CB8 460030A1 */ cvt.d.s $f2, $f6
/* 0D58BC 800D4CBC 44804800 */ mtc1 $zero, $f9
/* 0D58C0 800D4CC0 462A1002 */ mul.d $f0, $f2, $f10
+1 -12
View File
@@ -8,6 +8,7 @@ MAX_LINE_DIFF = 10
LINE_START_REGEX = r'\n(/\* ([0-9A-F]{6}) [0-9A-F]{8} [0-9A-F]{8} \*/\s+|\.L80[0-9A-F]{6}:)?'
REG_REGEX = r'(\$(at|v[0-1]|a[0-3]|t[0-9]|s[0-7]|f[0-9]{1,2}|k[01]|gp|sp|fp|ra|zero))'
GLABEL_UPPER_REGEX = '(' + LINE_START_REGEX + r'lui\s+' + REG_REGEX + r',\s+(0x80[0-9a-f]{2}))'
#GLABEL_UPPER_REGEX = '(' + LINE_START_REGEX + r'li\s+' + REG_REGEX + r',\s+(0x80[0-9A-F]{2})0000\s+#[^\n]*)'
GLABEL_LOWER_LS_REGEX = r'[sl][bhwd](u|c1)?\s+' + REG_REGEX + r',\s+(-?0x[0-9a-f]{3,4})\(\4\)'
GLABEL_LOWER_ADDU_REGEX = r'addiu\s+' + REG_REGEX + r',\s+\4,\s+(-?0x[0-9a-f]{3,4})'
GLABEL_LOWER_REGEX = LINE_START_REGEX + '(' + GLABEL_LOWER_LS_REGEX + '|' + GLABEL_LOWER_ADDU_REGEX + ')'
@@ -24,7 +25,6 @@ IGNORE_GLABELS = ['D_800E389E', 'D_801264A1', 'D_800E1B84']
def _find_glabels(asm):
glabels = []
for file in FileUtil.get_filenames_from_directory_recursive('.', '.s'):
#'''
contents = FileUtil.get_text_from_file(file)
matches = GLABEL_REGEX.findall(contents)
for match in matches:
@@ -56,17 +56,6 @@ def _find_glabels(asm):
contents)
if len(matches):
FileUtil.write_text_to_file(file, contents)
'''
matches = re.findall(LINE_START_REGEX + r'lui\s+' + REG_REGEX + r',\s+(0x800[1-9a-fA-F]|0x801[0-9a-fA-F])', FileUtil.get_text_from_file(file))
for match in matches:
offsets = (match[1]) # ROM offsets of the lu and lw
glabel_upper = int(match[4], 16) # upper immediate of glabel
glabel_lower = 0 # lower immediate of the glabel
if glabel_lower & 0x8000:
glabel_upper -= 1
glabel = 'D_%08X' % (glabel_upper << 16 | glabel_lower)
glabels.append((glabel, offsets))
#'''
return glabels
def main():
+2
View File
@@ -1814,6 +1814,7 @@ D_800E95F8 = 0x800E95F8;
D_800E95FC = 0x800E95FC;
D_800E9600 = 0x800E9600;
D_800E9628 = 0x800E9628;
D_800E9640 = 0x800E9640;
D_800E9650 = 0x800E9650;
D_800E9670 = 0x800E9670;
D_800E9690 = 0x800E9690;
@@ -1827,6 +1828,7 @@ D_800E97F0 = 0x800E97F0;
D_800E97F8 = 0x800E97F8;
D_800E9800 = 0x800E9800;
D_800E9810 = 0x800E9810;
D_800E9838 = 0x800E9838;
D_800E9840 = 0x800E9840;
D_800E9848 = 0x800E9848;
D_800E9850 = 0x800E9850;