diff --git a/asm/EntryPoint.s b/asm/EntryPoint.s index 69563496..c792367c 100644 --- a/asm/EntryPoint.s +++ b/asm/EntryPoint.s @@ -23,9 +23,9 @@ glabel EntryPoint /* 001018 80000418 AD000004 */ sw $zero, 4($t0) /* 00101C 8000041C 1520FFFC */ bnez $t1, .L80000410_ovl0 /* 001020 80000420 21080008 */ addi $t0, $t0, 8 -/* 001024 80000424 3C0A8000 */ lui $t2, %hi(main) # $t2, 0x8000 +/* 001024 80000424 3C0A8000 */ lui $t2, %hi(cboot) # $t2, 0x8000 /* 001028 80000428 3C1D8004 */ lui $sp, %hi(gEntryStack + 0x200) # $sp, 0x8004 -/* 00102C 8000042C 254A0870 */ addiu $t2, %lo(main) # addiu $t2, $t2, 0x870 +/* 00102C 8000042C 254A0870 */ addiu $t2, %lo(cboot) # addiu $t2, $t2, 0x870 /* 001030 80000430 01400008 */ jr $t2 /* 001034 80000434 27BD2D90 */ addiu $sp, %lo(gEntryStack + 0x200) # addiu $sp, $sp, 0x2d90 /* 001038 80000438 00000000 */ nop diff --git a/sfiles.txt b/sfiles.txt new file mode 100644 index 00000000..35a1fd45 --- /dev/null +++ b/sfiles.txt @@ -0,0 +1,241 @@ + +asm/non_matchings/ovl0/ovl0/func_80001E20.s +asm/non_matchings/ovl0/ovl0_2/func_800045C0.s +asm/non_matchings/ovl0/ovl0_2/func_800046FC.s +asm/non_matchings/ovl0/ovl0_2/func_80004C5C.s +asm/non_matchings/ovl0/ovl0_3/func_8000C144.s +asm/non_matchings/ovl0/ovl0_3/func_8000C17C.s +asm/non_matchings/ovl0/ovl0_3/func_8000C218.s +asm/non_matchings/ovl0/ovl0_3/func_8000E324.s +asm/non_matchings/ovl0/ovl0_4/func_800140FC.s +asm/non_matchings/ovl0/ovl0_4/func_800143A4.s +asm/non_matchings/ovl0/ovl0_4/func_80014768.s +asm/non_matchings/ovl0/ovl0_4/func_8001479C.s +asm/non_matchings/ovl0/ovl0_4/func_800147C8.s +asm/non_matchings/ovl0/ovl0_4/func_80014B4C.s +asm/non_matchings/ovl0/ovl0_4/func_80014FA4.s +asm/non_matchings/ovl0/ovl0_4/func_8001585C.s +asm/non_matchings/ovl0/ovl0_4/func_8001588C.s +asm/non_matchings/ovl0/ovl0_4/func_80016940.s +asm/non_matchings/ovl0/ovl0_4/func_800171E0.s +asm/non_matchings/ovl0/ovl0_4/func_80017B6C.s +asm/non_matchings/ovl0/ovl0_4/func_80017C7C.s +asm/non_matchings/ovl0/ovl0_4/func_80017DB0.s +asm/non_matchings/ovl0/ovl0_5/func_800191F8.s +asm/non_matchings/ovl0/ovl0_6/func_8001B5E4.s +asm/non_matchings/ovl0/ovl0_6/func_8001BBAC.s +asm/non_matchings/ovl0/ovl0_6/func_8001CF00.s +asm/non_matchings/ovl0/ovl0_6/func_8001E300.s +asm/non_matchings/ovl0/ovl0_7/func_800208A0.s +asm/non_matchings/ovl0/ovl0_7/func_80020968.s +asm/non_matchings/ovl0/ovl0_7/func_80020998.s +asm/non_matchings/ovl0/ovl0_7/func_80020EB4.s +asm/non_matchings/ovl0/ovl0_8/func_80021D34.s +asm/non_matchings/ovl0/ovl0_8/func_80022A38.s +asm/non_matchings/ovl0/ovl0_8/func_80022A44.s +asm/non_matchings/ovl0_1/func_80002FC0.s +asm/non_matchings/ovl1/ovl1/func_8009B768.s +asm/non_matchings/ovl1/ovl1/func_8009C0E4.s +asm/non_matchings/ovl1/ovl1/func_8009E8F4.s +asm/non_matchings/ovl1/ovl1/func_800A1F30.s +asm/non_matchings/ovl1/ovl1/func_800A2024.s +asm/non_matchings/ovl1/ovl1/func_800A22D4.s +asm/non_matchings/ovl1/ovl1/func_800A2300.s +asm/non_matchings/ovl1/ovl1_1/func_800A377C.s +asm/non_matchings/ovl1/ovl1_1/func_800A41B0.s +asm/non_matchings/ovl1/ovl1_1/func_800A465C.s +asm/non_matchings/ovl1/ovl1_1/func_800A4DB8.s +asm/non_matchings/ovl1/ovl1_1/func_800A5404.s +asm/non_matchings/ovl1/ovl1_1/func_800A5744.s +asm/non_matchings/ovl1/ovl1_1/func_800A57A0.s +asm/non_matchings/ovl1/ovl1_1/func_800A5A14.s +asm/non_matchings/ovl1/ovl1_1/func_800A5B14.s +asm/non_matchings/ovl1/ovl1_1/func_800A5B3C.s +asm/non_matchings/ovl1/ovl1_1/func_800A699C.s +asm/non_matchings/ovl1/ovl1_1/func_800A6A18.s +asm/non_matchings/ovl1/ovl1_10/func_800BB24C.s +asm/non_matchings/ovl1/ovl1_10/func_800BB364.s +asm/non_matchings/ovl1/ovl1_10/func_800BB394.s +asm/non_matchings/ovl1/ovl1_10/func_800BB3C0.s +asm/non_matchings/ovl1/ovl1_10/func_800BB440.s +asm/non_matchings/ovl1/ovl1_10/func_800BB468.s +asm/non_matchings/ovl1/ovl1_12/func_800BBDC4.s +asm/non_matchings/ovl1/ovl1_13/draw_hp_segment.s +asm/non_matchings/ovl1/ovl1_13/draw_lives_digit.s +asm/non_matchings/ovl1/ovl1_13/draw_star_segments.s +asm/non_matchings/ovl1/ovl1_13/func_800BD460.s +asm/non_matchings/ovl1/ovl1_13/func_800BD6E0.s +asm/non_matchings/ovl1/ovl1_13/func_800BD7FC.s +asm/non_matchings/ovl1/ovl1_13/func_800BD92C.s +asm/non_matchings/ovl1/ovl1_2/func_800A6BC0.s +asm/non_matchings/ovl1/ovl1_2/func_800A6E64.s +asm/non_matchings/ovl1/ovl1_2/func_800A71A0.s +asm/non_matchings/ovl1/ovl1_2/func_800A74D8.s +asm/non_matchings/ovl1/ovl1_2/func_800A75B0.s +asm/non_matchings/ovl1/ovl1_2/func_800A77E8.s +asm/non_matchings/ovl1/ovl1_2/func_800A7870.s +asm/non_matchings/ovl1/ovl1_2/func_800A78D0.s +asm/non_matchings/ovl1/ovl1_2/func_800A7F74.s +asm/non_matchings/ovl1/ovl1_2/func_800A802C.s +asm/non_matchings/ovl1/ovl1_2/func_800A8100.s +asm/non_matchings/ovl1/ovl1_2/func_800A8234.s +asm/non_matchings/ovl1/ovl1_3/func_800A8358.s +asm/non_matchings/ovl1/ovl1_3/func_800A8578.s +asm/non_matchings/ovl1/ovl1_3/func_800A86C8.s +asm/non_matchings/ovl1/ovl1_3/func_800A8724.s +asm/non_matchings/ovl1/ovl1_3/func_800A8A7C.s +asm/non_matchings/ovl1/ovl1_3/func_800A8BAC.s +asm/non_matchings/ovl1/ovl1_3/func_800A8C40.s +asm/non_matchings/ovl1/ovl1_3/func_800A8EC0.s +asm/non_matchings/ovl1/ovl1_3/func_800A94F4.s +asm/non_matchings/ovl1/ovl1_3/func_800A9760.s +asm/non_matchings/ovl1/ovl1_3/func_800A9864.s +asm/non_matchings/ovl1/ovl1_3/func_800A99E4.s +asm/non_matchings/ovl1/ovl1_3/func_800A9AA8.s +asm/non_matchings/ovl1/ovl1_3/func_800A9D64.s +asm/non_matchings/ovl1/ovl1_3/func_800A9EA4.s +asm/non_matchings/ovl1/ovl1_3/func_800A9F98.s +asm/non_matchings/ovl1/ovl1_3/func_800AA038.s +asm/non_matchings/ovl1/ovl1_3/func_800AA0C4.s +asm/non_matchings/ovl1/ovl1_3/func_800AA154.s +asm/non_matchings/ovl1/ovl1_3/func_800AA608.s +asm/non_matchings/ovl1/ovl1_3/func_800AA78C.s +asm/non_matchings/ovl1/ovl1_3/func_800AA864.s +asm/non_matchings/ovl1/ovl1_3/func_800AAF34.s +asm/non_matchings/ovl1/ovl1_5/func_800AC610.s +asm/non_matchings/ovl1/ovl1_5/func_800AC954.s +asm/non_matchings/ovl1/ovl1_5/func_800ACB7C.s +asm/non_matchings/ovl1/ovl1_5/func_800AE048.s +asm/non_matchings/ovl1/ovl1_6/func_800AE138.s +asm/non_matchings/ovl1/ovl1_7/func_800AEFFC.s +asm/non_matchings/ovl1/ovl1_7/func_800AF0F4.s +asm/non_matchings/ovl1/ovl1_7/func_800AF27C.s +asm/non_matchings/ovl1/ovl1_7/func_800AF408.s +asm/non_matchings/ovl1/ovl1_7/func_800AF7EC.s +asm/non_matchings/ovl1/ovl1_7/func_800AF920.s +asm/non_matchings/ovl1/ovl1_7/func_800AFA14.s +asm/non_matchings/ovl1/ovl1_7/func_800AFBB4.s +asm/non_matchings/ovl1/ovl1_7/func_800B0F28.s +asm/non_matchings/ovl1/ovl1_7/func_800B19F4.s +asm/non_matchings/ovl1/ovl1_7/func_800B1C7C.s +asm/non_matchings/ovl1/ovl1_7/func_800B1F68.s +asm/non_matchings/ovl1/ovl1_7/func_800B2288.s +asm/non_matchings/ovl1/ovl1_7/func_800B2340.s +asm/non_matchings/ovl1/ovl1_7/func_800B26D8.s +asm/non_matchings/ovl1/ovl1_7/func_800B2F54.s +asm/non_matchings/ovl1/ovl1_7/func_800B3158.s +asm/non_matchings/ovl1/ovl1_7/func_800B3234.s +asm/non_matchings/ovl1/ovl1_8/func_800B6144.s +asm/non_matchings/ovl1/ovl1_8/func_800B7E44.s +asm/non_matchings/ovl1/ovl1_9/func_800B86FC.s +asm/non_matchings/ovl1/ovl1_9/func_800B9068.s +asm/non_matchings/ovl1/ovl1_9/func_800B9DF8.s +asm/non_matchings/ovl1/ovl1_9/func_800BA5C4.s +asm/non_matchings/ovl11/ovl11/func_801DB8E8_ovl11.s +asm/non_matchings/ovl12/0/ovl12/11.s +asm/non_matchings/ovl12/0/ovl12/16.s +asm/non_matchings/ovl12/0/ovl12/17.s +asm/non_matchings/ovl12/0/ovl12/26.s +asm/non_matchings/ovl12/0/ovl12/63.s +asm/non_matchings/ovl12/0/ovl12/82.s +asm/non_matchings/ovl12/0/ovl12/88.s +asm/non_matchings/ovl12/0/ovl12/89.s +asm/non_matchings/ovl12/0/ovl12/9.s +asm/non_matchings/ovl12/0/ovl12/96.s +asm/non_matchings/ovl12/0/ovl12/97.s +asm/non_matchings/ovl18/ovl18/func_8021E978_ovl18.s +asm/non_matchings/ovl18/ovl18/func_8021ED10_ovl18.s +asm/non_matchings/ovl18/ovl18/func_8021ED3C_ovl18.s +asm/non_matchings/ovl18/ovl18/func_8021F5CC_ovl18.s +asm/non_matchings/ovl18/ovl18_1/func_80220F68_ovl18.s +asm/non_matchings/ovl18/ovl18_5/func_80225958_ovl18.s +asm/non_matchings/ovl18/ovl18_5/func_80225B44_ovl18.s +asm/non_matchings/ovl19/ovl19_2/func_80222500_ovl19.s +asm/non_matchings/ovl2_2/func_800F753C.s +asm/non_matchings/ovl2_2/func_800F8464.s +asm/non_matchings/ovl2_3/func_800F88A0.s +asm/non_matchings/ovl2_3/func_800F88C8.s +asm/non_matchings/ovl2_3/func_800F8E6C.s +asm/non_matchings/ovl2_3/func_800F951C.s +asm/non_matchings/ovl2_3/func_800F98EC.s +asm/non_matchings/ovl2_3/func_800FA1D4.s +asm/non_matchings/ovl2_3/func_800FA414.s +asm/non_matchings/ovl2_3/func_800FB914.s +asm/non_matchings/ovl2_3/func_800FBE1C.s +asm/non_matchings/ovl2_3/func_800FBF18.s +asm/non_matchings/ovl2_4/func_800FD570.s +asm/non_matchings/ovl2_4/func_800FD754.s +asm/non_matchings/ovl2_5/func_800FE154.s +asm/non_matchings/ovl2_5/func_800FF200.s +asm/non_matchings/ovl2_6/func_80101400.s +asm/non_matchings/ovl2_6/func_80102570.s +asm/non_matchings/ovl2_6/func_80103528.s +asm/non_matchings/ovl2_6/func_80103B58.s +asm/non_matchings/ovl2_6/func_80105180.s +asm/non_matchings/ovl2_6/func_8010D8A4.s +asm/non_matchings/ovl2_6/func_8010DD8C.s +asm/non_matchings/ovl2_6/func_8010DF9C.s +asm/non_matchings/ovl2_6/func_8010E288.s +asm/non_matchings/ovl2_6/func_8010E2A0.s +asm/non_matchings/ovl2_6/func_8010E8F0.s +asm/non_matchings/ovl2_6/func_80110150.s +asm/non_matchings/ovl2_6/func_80110B00.s +asm/non_matchings/ovl2_6/func_80110FD4.s +asm/non_matchings/ovl2_6/func_80111550.s +asm/non_matchings/ovl2_6/func_801117BC.s +asm/non_matchings/ovl2_6/func_80111A04.s +asm/non_matchings/ovl2_6/func_80111C4C.s +asm/non_matchings/ovl2_6/func_80111C88.s +asm/non_matchings/ovl2_6/func_80111ECC.s +asm/non_matchings/ovl2_8/func_8011BD30.s +asm/non_matchings/ovl2_8/func_8011D4A4.s +asm/non_matchings/ovl2_8/func_8011DAF8.s +asm/non_matchings/ovl2_8/func_8011E548.s +asm/non_matchings/ovl2_8/func_8011ED68.s +asm/non_matchings/ovl2_8/func_80120BCC.s +asm/non_matchings/ovl2_8/func_801210B4.s +asm/non_matchings/ovl2_8/func_801210FC.s +asm/non_matchings/ovl2_8/func_80121284.s +asm/non_matchings/ovl2_8/func_801215DC.s +asm/non_matchings/ovl2_8/func_801217B8.s +asm/non_matchings/ovl2_8/func_80121A04.s +asm/non_matchings/ovl2_8/func_80121BCC.s +asm/non_matchings/ovl2_8/func_80121D3C.s +asm/non_matchings/ovl2_8/func_80121F14.s +asm/non_matchings/ovl2_8/func_80121F50.s +asm/non_matchings/ovl2_8/func_8012209C.s +asm/non_matchings/ovl2_8/func_80122558.s +asm/non_matchings/ovl2_8/func_801226FC.s +asm/non_matchings/ovl2_8/func_8012307C.s +asm/non_matchings/ovl3/ovl3/func_80151E94_ovl3.s +asm/non_matchings/ovl3/ovl3_1/func_80153984_ovl3.s +asm/non_matchings/ovl3/ovl3_1/func_8015449C_ovl3.s +asm/non_matchings/ovl3/ovl3_1/func_80154648_ovl3.s +asm/non_matchings/ovl3/ovl3_5/func_80179130_ovl3.s +asm/non_matchings/ovl4/ovl4/func_80151CEC_ovl4.s +asm/non_matchings/ovl6/func_80153064.s +asm/non_matchings/ovl6/func_80153F2C.s +asm/non_matchings/ovl7/ovl7_16/func_801BEF18_ovl7.s +asm/non_matchings/ovl9/ovl9_13/func_80219E0C_ovl9.s +asm/non_matchings/ovl9/ovl9_16/func_8021A9F0_ovl9.s +asm/non_matchings/ovl9/ovl9_16/func_8021B8B0_ovl9.s +asm/non_matchings/ovl9/ovl9_9/func_802079F4_ovl9.s +asm/non_matchings/ovl9/ovl9_9/func_80207C24_ovl9.s +asm/non_matchings/ovl9/ovl9_9/func_80208604_ovl9.s +asm/non_matchings/ovl9/ovl9_9/func_80208758_ovl9.s +asm/ovl0/libultra_after_bcopy.s +asm/ovl0/ovl0_9.s +asm/ovl13/ovl13.s +asm/ovl14/ovl14.s +asm/ovl17/ovl17_0.s +asm/ovl3/ovl3_3.s +asm/ovl3/ovl3_4.s +asm/ovl7/ovl7_1.s +asm/ovl7/ovl7_2.s +asm/ovl7/ovl7_3.s +asm/ovl7/ovl7_4.s +asm/ovl7/ovl7_5.s +asm/ovl7/ovl7_6.s +asm/ovl8/ovl8.s +asm/ovl9/ovl9.s +asm/ovl9/ovl9_8.s diff --git a/src/ovl0/main.c b/src/ovl0/main.c index 564a3d82..505ecc45 100644 --- a/src/ovl0/main.c +++ b/src/ovl0/main.c @@ -157,7 +157,7 @@ void thread1_idle(void *arg) { while (1); } -void main(void) { +void cboot(void) { gEntryStack[7] = STACK_TOP_MAGIC; osInitialize(); osCreateThread(&gIdleThread, 1, thread1_idle, &D_80048B00, &idleThreadStack[IDLE_THREAD_STACK_LEN_U64], OS_PRIORITY_APPMAX); diff --git a/tools/asm-processor/asm_processor.py b/tools/asm-processor/asm_processor.py index 05852dfc..65a5e908 100644 --- a/tools/asm-processor/asm_processor.py +++ b/tools/asm-processor/asm_processor.py @@ -561,6 +561,8 @@ class GlobalAsmBlock: self.add_sized(2*len(line.split(',')), real_line) elif line.startswith('.type'): self.asm_conts.append(real_line) + elif line.startswith('.size'): + self.asm_conts.append(real_line) elif line.startswith('.'): # .macro, ... self.fail("asm directive not supported", real_line) diff --git a/tools/find_unfixed_funcs.py b/tools/find_unfixed_funcs.py new file mode 100644 index 00000000..0c2bc896 --- /dev/null +++ b/tools/find_unfixed_funcs.py @@ -0,0 +1,19 @@ +import sys, os, subprocess + +funclist = [] + +with open(sys.argv[1]) as f: + funclist = f.readlines() + +funcs = [i[:-1] for i in funclist] + +for func in funcs: + P = subprocess.Popen(["git", "grep", f"{func}"], stdout=subprocess.PIPE) + pp = P.communicate()[0].decode("ascii").split("\n") + + found = "" + for j in pp: + if "glabel" in j and func in j: + found = j.split(":")[0] + + print(found) diff --git a/tools/folder_fixsplatify.py b/tools/folder_fixsplatify.py new file mode 100644 index 00000000..1ac68245 --- /dev/null +++ b/tools/folder_fixsplatify.py @@ -0,0 +1,55 @@ + + +import sys, os, glob +# flist = glob.glob(f"{sys.argv[1]}/*.s", recursive=True) +fl = [] + +with open(sys.argv[1]) as f: + fl = f.readlines() + +flist = [i[:-1] for i in fl if "non_matchings" in i] +# flist = [sys.argv[1]] + +print(flist) +# sys.exit() + +# print(flist) +def endf(l): + return not False in [z == "\n" for z in l] + +for fn in flist: + fl = [] + with open(fn) as f: + fl = f.readlines() + flout = [] + inFunc = False + func = "" + for i, l in enumerate(fl): + # print(l) + if ".section .late_rodata" in l: + inFunc = False + flout.append(l) + elif "glabel " in l and inFunc == False: + inFunc = True + func = l[:-1].split()[1] + flout.append(l) + # flout.append(f".ent {func}\n") + elif inFunc: + if l == "\n" and endf(fl[i:]): + # flout.append(f".end {func}\n") + # flout.append(f"\n.type {func}, @function\n") + flout.append(f".size {func}, . - {func}\n") + flout.append(l) + inFunc = False + elif i == len(fl) - 1: + flout.append(l) + # flout.append(f".end {func}\n") + # flout.append(f"\n.type {func}, @function\n") + flout.append(f".size {func}, . - {func}\n") + else: + flout.append(l) + else: + flout.append(l) + with open(fn, "w+") as f: + f.write("".join(flout)) + diff --git a/tools/full_splatify.py b/tools/full_splatify.py new file mode 100644 index 00000000..a61f35f7 --- /dev/null +++ b/tools/full_splatify.py @@ -0,0 +1,43 @@ + + +import sys, os, glob +# flist = glob.glob("asm/non_matchings/**/*.s", recursive=True) +flist = [sys.argv[1]] + +# print(flist) +for fn in flist: + fl = [] + with open(fn) as f: + fl = f.readlines() + flout = [] + inFunc = False + func = "" + for i, l in enumerate(fl): + # print(l) + if ".section .late_rodata" in l: + inFunc = False + flout.append(l) + elif "glabel " in l: + inFunc = True + func = l[:-1].split()[1] + flout.append(l) + # flout.append(f".ent {func}\n") + elif inFunc: + if l == "\n": + # flout.append(f".end {func}\n") + flout.append(f"\n.type {func}, @function\n") + flout.append(f".size {func}, . - {func}\n") + flout.append(l) + inFunc = False + elif i == len(fl) - 1: + flout.append(l) + # flout.append(f".end {func}\n") + flout.append(f"\n.type {func}, @function\n") + flout.append(f".size {func}, . - {func}\n") + else: + flout.append(l) + else: + flout.append(l) + with open(fn, "w+") as f: + f.write("".join(flout)) + diff --git a/tools/single_splatify.py b/tools/single_splatify.py new file mode 100644 index 00000000..71426d62 --- /dev/null +++ b/tools/single_splatify.py @@ -0,0 +1,42 @@ + + +import sys, os, glob +# flist = glob.glob("asm/non_matchings/**/*.s", recursive=True) +flist = [sys.argv[1]] + +# print(flist) +for fn in flist: + fl = [] + with open(fn) as f: + fl = f.readlines() + flout = [] + inFunc = False + func = "" + for i, l in enumerate(fl): + # print(l) + if ".section .late_rodata" in l: + inFunc = False + flout.append(l) + elif "glabel " in l: + inFunc = True + func = l[:-1].split()[1] + flout.append(l) + # flout.append(f".ent {func}\n") + elif inFunc: + if l == "\n": + # flout.append(f".end {func}\n") + flout.append(f"\n.type {func}, @function\n") + flout.append(f".size {func}, . - {func}\n") + flout.append(l) + elif i == len(fl) - 1: + flout.append(l) + # flout.append(f".end {func}\n") + flout.append(f"\n.type {func}, @function\n") + flout.append(f".size {func}, . - {func}\n") + else: + flout.append(l) + else: + flout.append(l) + with open(fn, "w+") as f: + f.write("".join(flout)) +