Added glabels for doubles

This commit is contained in:
Antonio Castelli
2021-05-29 13:19:00 -07:00
parent a7b72ece1c
commit b7ce969d08
12 changed files with 59 additions and 28 deletions
+2
View File
@@ -10,6 +10,8 @@
glabel D_800E94B0
.word 0x412E8480
.word 0x00000000
glabel D_800E94B8
.word 0x412E8480
.word 0x00000000
+2
View File
@@ -63,6 +63,8 @@ glabel D_800E9600
.word 0x800CC144
.word 0x800CC104
.word 0x00000000
glabel D_800E9628
.word 0x3FFFFFD6
.word 0x0E94EE39
.word 0x3FFFFEB0
+12 -1
View File
@@ -18,10 +18,16 @@ glabel D_800E97C0
.word 0xEEA56814
.word 0x3EC5DBDF
.word 0x0E314BFE
glabel D_800E97E8
.word 0x3FD45F30
.word 0x6DC9C883
glabel D_800E97F0
.word 0x400921FB
.word 0x50000000
glabel D_800E97F8
.word 0x3E6110B4
.word 0x611A6263
.word 0x00000000
@@ -42,8 +48,12 @@ glabel D_800E9810
.word 0x0E314BFE
.word 0x3FD45F30
.word 0x6DC9C883
glabel D_800E9840
.word 0x400921FB
.word 0x50000000
glabel D_800E9848
.word 0x3E6110B4
.word 0x611A6263
.word 0x00000000
@@ -79,8 +89,9 @@ glabel D_800E98AC
glabel D_800E98B0
.word 0x30000000
.word 0x00000000
glabel D_800E98B8
.word 0x4197D784
.word 0x00000000
@@ -1,9 +1,9 @@
glabel func_800C8284
/* 0C8E84 800C8284 8C8E0000 */ lw $t6, ($a0)
/* 0C8E88 800C8288 44856000 */ mtc1 $a1, $f12
/* 0C8E8C 800C828C 3C01800F */ lui $at, 0x800f
/* 0C8E8C 800C828C 3C01800F */ lui $at, %hi(D_800E94B0) #$at, 0x800f
/* 0C8E90 800C8290 8DCF0040 */ lw $t7, 0x40($t6)
/* 0C8E94 800C8294 D42694B0 */ ldc1 $f6, -0x6b50($at)
/* 0C8E94 800C8294 D42694B0 */ ldc1 $f6, %lo(D_800E94B0)($at)
/* 0C8E98 800C8298 46006121 */ cvt.d.s $f4, $f12
/* 0C8E9C 800C829C 448F5000 */ mtc1 $t7, $f10
/* 0C8EA0 800C82A0 46262202 */ mul.d $f8, $f4, $f6
@@ -21,8 +21,8 @@ glabel func_800C8380
/* 0C8FC8 800C83C8 00000000 */ nop
/* 0C8FCC 800C83CC 46068400 */ add.s $f16, $f16, $f6
.L800C83D0:
/* 0C8FD0 800C83D0 3C01800F */ lui $at, 0x800f
/* 0C8FD4 800C83D4 D43294B8 */ ldc1 $f18, -0x6b48($at)
/* 0C8FD0 800C83D0 3C01800F */ lui $at, %hi(D_800E94B8) #$at, 0x800f
/* 0C8FD4 800C83D4 D43294B8 */ ldc1 $f18, %lo(D_800E94B8)($at)
/* 0C8FD8 800C83D8 460082A1 */ cvt.d.s $f10, $f16
/* 0C8FDC 800C83DC 46325202 */ mul.d $f8, $f10, $f18
/* 0C8FE0 800C83E0 46282183 */ div.d $f6, $f4, $f8
@@ -41,8 +41,8 @@ glabel alResamplePull
/* 0CCE14 800CC214 AC4D0004 */ sw $t5, 4($v0)
/* 0CCE18 800CC218 C5020018 */ lwc1 $f2, 0x18($t0)
.L800CC21C:
/* 0CCE1C 800CC21C 3C01800F */ lui $at, 0x800f
/* 0CCE20 800CC220 D4249628 */ ldc1 $f4, -0x69d8($at)
/* 0CCE1C 800CC21C 3C01800F */ lui $at, %hi(D_800E9628) #$at, 0x800f
/* 0CCE20 800CC220 D4249628 */ ldc1 $f4, %lo(D_800E9628)($at)
/* 0CCE24 800CC224 460011A1 */ cvt.d.s $f6, $f2
/* 0CCE28 800CC228 3C01800F */ lui $at, 0x800f
/* 0CCE2C 800CC22C 4626203C */ c.lt.d $f4, $f6
@@ -229,8 +229,8 @@ glabel _Ldtob
/* 0D7E34 800D7234 1A800008 */ blez $s4, .L800D7258
/* 0D7E38 800D7238 00000000 */ nop
/* 0D7E3C 800D723C 44915000 */ mtc1 $s1, $f10
/* 0D7E40 800D7240 3C01800F */ lui $at, 0x800f
/* 0D7E44 800D7244 D42898B8 */ ldc1 $f8, -0x6748($at)
/* 0D7E40 800D7240 3C01800F */ lui $at, %hi(D_800E98B8) #$at, 0x800f
/* 0D7E44 800D7244 D42898B8 */ ldc1 $f8, %lo(D_800E98B8)($at)
/* 0D7E48 800D7248 46805121 */ cvt.d.w $f4, $f10
/* 0D7E4C 800D724C 4624A181 */ sub.d $f6, $f20, $f4
/* 0D7E50 800D7250 46283502 */ mul.d $f20, $f6, $f8
+6 -6
View File
@@ -13,14 +13,14 @@ glabel cosf
/* 0D56DC 800D4ADC 44819800 */ mtc1 $at, $f19
/* 0D56E0 800D4AE0 4606203C */ c.lt.s $f4, $f6
/* 0D56E4 800D4AE4 C7A00000 */ lwc1 $f0, ($sp)
/* 0D56E8 800D4AE8 3C01800F */ lui $at, 0x800f
/* 0D56E8 800D4AE8 3C01800F */ lui $at, %hi(D_800E97E8) #$at, 0x800f
/* 0D56EC 800D4AEC 45020004 */ bc1fl .L800D4B00
/* 0D56F0 800D4AF0 46000007 */ neg.s $f0, $f0
/* 0D56F4 800D4AF4 10000002 */ b .L800D4B00
/* 0D56F8 800D4AF8 46003006 */ mov.s $f0, $f6
/* 0D56FC 800D4AFC 46000007 */ neg.s $f0, $f0
.L800D4B00:
/* 0D5700 800D4B00 D42897E8 */ ldc1 $f8, -0x6818($at)
/* 0D5700 800D4B00 D42897E8 */ ldc1 $f8, %lo(D_800E97E8)($at)
/* 0D5704 800D4B04 46000321 */ cvt.d.s $f12, $f0
/* 0D5708 800D4B08 44809000 */ mtc1 $zero, $f18
/* 0D570C 800D4B0C 46286282 */ mul.d $f10, $f12, $f8
@@ -43,11 +43,11 @@ glabel cosf
/* 0D574C 800D4B4C 00000000 */ nop
/* 0D5750 800D4B50 44823000 */ mtc1 $v0, $f6
.L800D4B54:
/* 0D5754 800D4B54 3C01800F */ lui $at, 0x800f
/* 0D5758 800D4B58 D42A97F0 */ ldc1 $f10, -0x6810($at)
/* 0D5754 800D4B54 3C01800F */ lui $at, %hi(D_800E97F0) # $at, 0x800f
/* 0D5758 800D4B58 D42A97F0 */ ldc1 $f10, %lo(D_800E97F0)($at)
/* 0D575C 800D4B5C 46803221 */ cvt.d.w $f8, $f6
/* 0D5760 800D4B60 3C01800F */ lui $at, 0x800f
/* 0D5764 800D4B64 D42697F8 */ ldc1 $f6, -0x6808($at)
/* 0D5760 800D4B60 3C01800F */ lui $at, %hi(D_800E97F8) # $at, 0x800f
/* 0D5764 800D4B64 D42697F8 */ ldc1 $f6, %lo(D_800E97F8)($at)
/* 0D5768 800D4B68 3C03800F */ lui $v1, %hi(D_800E97C0) # $v1, 0x800f
/* 0D576C 800D4B6C 246397C0 */ addiu $v1, %lo(D_800E97C0) # addiu $v1, $v1, -0x6840
/* 0D5770 800D4B70 46324001 */ sub.d $f0, $f8, $f18
+4 -4
View File
@@ -69,11 +69,11 @@ glabel sinf
/* 0D5918 800D4D18 00000000 */ nop
/* 0D591C 800D4D1C 44828000 */ mtc1 $v0, $f16
.L800D4D20:
/* 0D5920 800D4D20 3C01800F */ lui $at, 0x800f
/* 0D5924 800D4D24 D4329840 */ ldc1 $f18, -0x67c0($at)
/* 0D5920 800D4D20 3C01800F */ lui $at, %hi(D_800E9840) #$at, 0x800f
/* 0D5924 800D4D24 D4329840 */ ldc1 $f18, %lo(D_800E9840)($at)
/* 0D5928 800D4D28 46808021 */ cvt.d.w $f0, $f16
/* 0D592C 800D4D2C 3C01800F */ lui $at, 0x800f
/* 0D5930 800D4D30 D4269848 */ ldc1 $f6, -0x67b8($at)
/* 0D592C 800D4D2C 3C01800F */ lui $at, %hi(D_800E9848) #$at, 0x800f
/* 0D5930 800D4D30 D4269848 */ ldc1 $f6, %lo(D_800E9848)($at)
/* 0D5934 800D4D34 3C03800F */ lui $v1, %hi(D_800E9810) # $v1, 0x800f
/* 0D5938 800D4D38 24639810 */ addiu $v1, %lo(D_800E9810) # addiu $v1, $v1, -0x67f0
/* 0D593C 800D4D3C 46320102 */ mul.d $f4, $f0, $f18
+4 -7
View File
@@ -72,13 +72,10 @@ s16 D_800DC7B8[52] = {
0x0003, 0x0004, 0x0051, 0x0054,
0x0055, 0x0056, 0x00ED, 0x00FF,
0x0001, 0x0002, 0x0003, 0x0004,
0x0051,
//s16 D_800DC802[15] = { 37
0x0054, 0x0055, 0x0056, 0x00ED,
0x00FF, 0x00D9, 0x00DF, 0x00E0,
0x0105, 0x008A, 0x00DA, 0x00E8,
0x0115, 0x0118, 0x0000
0x0051, 0x0054, 0x0055, 0x0056,
0x00ED, 0x00FF, 0x00D9, 0x00DF,
0x00E0, 0x0105, 0x008A, 0x00DA,
0x00E8, 0x0115, 0x0118, 0x0000
};
s16 D_800DC820[16] = {
+14 -2
View File
@@ -5,17 +5,18 @@ from file_util import FileUtil
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[0-1]|gp|sp|fp|ra|zero))'
GLABEL_UPPER_REGEX = '(' + LINE_START_REGEX + r'lui\s+' + REG_REGEX + r',\s+(0x80[0-9a-f]{2}))'
GLABEL_LOWER_REGEX = '(' + LINE_START_REGEX + r'[sl][bhw](u|c1)?\s+' + REG_REGEX + r',\s+(-?0x[0-9a-f]{4})\(\4\))'
GLABEL_LOWER_REGEX = '(' + LINE_START_REGEX + r'[sl][bhwd](u|c1)?\s+' + REG_REGEX + r',\s+(-?0x[0-9a-f]{4})\(\4\))'
GLABEL_REGEX = GLABEL_UPPER_REGEX + '(' + LINE_START_REGEX + '[^\n]*){0,10}' + GLABEL_LOWER_REGEX
UPPER_INSTR_REGEX_TMPL = r'(/\* %s[^\n]*lui\s+)([^\n]*)'
LOWER_INSTR_REGEX_TMPL = r'(/\* %s[^\n]*[ls][bhw](u|c1)?\s+' + REG_REGEX + r',\s+)-?0x[0-9a-f]{4}([^\n]*)'
LOWER_INSTR_REGEX_TMPL = r'(/\* %s[^\n]*[ls][bhwd](u|c1)?\s+' + REG_REGEX + r',\s+)-?0x[0-9a-f]{4}([^\n]*)'
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 = re.findall(GLABEL_REGEX, contents)
for match in matches:
@@ -40,6 +41,17 @@ 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():
+7
View File
@@ -1804,6 +1804,7 @@ D_800E95B0 = 0x800E95B0;
D_800E95F8 = 0x800E95F8;
D_800E95FC = 0x800E95FC;
D_800E9600 = 0x800E9600;
D_800E9628 = 0x800E9628;
D_800E9650 = 0x800E9650;
D_800E9670 = 0x800E9670;
D_800E9690 = 0x800E9690;
@@ -1812,11 +1813,17 @@ D_800E96C4 = 0x800E96C4;
D_800E96CC = 0x800E96CC;
D_800E96E4 = 0x800E96E4;
D_800E97C0 = 0x800E97C0;
D_800E97E8 = 0x800E97E8;
D_800E97F0 = 0x800E97F0;
D_800E97F8 = 0x800E97F8;
D_800E9810 = 0x800E9810;
D_800E9840 = 0x800E9840;
D_800E9848 = 0x800E9848;
D_800E9860 = 0x800E9860;
D_800E98A8 = 0x800E98A8;
D_800E98AC = 0x800E98AC;
D_800E98B0 = 0x800E98B0;
D_800E98B8 = 0x800E98B8;
D_800E98C0 = 0x800E98C0;
D_800E98D0 = 0x800E98D0;
D_800EA3A0 = 0x800EA3A0;