From 76d1584c89140a0163329c5866b0218c04595deb Mon Sep 17 00:00:00 2001 From: Jonathan Hohle Date: Fri, 17 May 2024 00:45:26 -0700 Subject: [PATCH] Replace BIOS Trampolines (#1133) This replaces several dozen BIOS trampolines from the extracted ASM to "decompiled" source. These are modeled on the `INCLUDE_ASM` macro, but generate the instructions necessary for each trampoline directly instead of importing an extracted source file. Because these trampolines never return, and GCC 2.6 doesnt appear to have builtins for leaving off the return jump postamble, these will likely need to remain assembly. This also changes the `main.elf` target to depend on `main.ld`, and undefined symbols files, allowing `make build` to regenerate those files if necessary. Co-authored-by: Jonathan Hohle --- Makefile | 2 +- config/splat.us.main.yaml | 109 +++++++++++++++++---------------- include/bios.h | 55 +++++++++++++++++ include/psxsdk/libapi.h | 2 +- include/psxsdk/libc.h | 2 + src/main/psxsdk/libapi/a07.c | 3 + src/main/psxsdk/libapi/a08.c | 3 + src/main/psxsdk/libapi/a09.c | 3 + src/main/psxsdk/libapi/a10.c | 3 + src/main/psxsdk/libapi/a11.c | 3 + src/main/psxsdk/libapi/a12.c | 3 + src/main/psxsdk/libapi/a13.c | 3 + src/main/psxsdk/libapi/a20.c | 3 + src/main/psxsdk/libapi/a21.c | 3 + src/main/psxsdk/libapi/a22.c | 3 + src/main/psxsdk/libapi/a23.c | 3 + src/main/psxsdk/libapi/a24.c | 3 + src/main/psxsdk/libapi/a25.c | 3 + src/main/psxsdk/libapi/a36.c | 3 + src/main/psxsdk/libapi/a37.c | 3 + src/main/psxsdk/libapi/a50.c | 3 + src/main/psxsdk/libapi/a51.c | 3 + src/main/psxsdk/libapi/a52.c | 3 + src/main/psxsdk/libapi/a53.c | 3 + src/main/psxsdk/libapi/a54.c | 3 + src/main/psxsdk/libapi/a65.c | 3 + src/main/psxsdk/libapi/a66.c | 3 + src/main/psxsdk/libapi/a67.c | 3 + src/main/psxsdk/libapi/a69.c | 3 + src/main/psxsdk/libapi/a81.c | 3 + src/main/psxsdk/libapi/a91.c | 3 + src/main/psxsdk/libapi/c112.c | 3 + src/main/psxsdk/libapi/c114.c | 3 + src/main/psxsdk/libapi/c57.c | 3 + src/main/psxsdk/libapi/c66.c | 3 + src/main/psxsdk/libapi/c67.c | 3 + src/main/psxsdk/libapi/c68.c | 3 + src/main/psxsdk/libapi/c73.c | 3 + src/main/psxsdk/libapi/l10.c | 3 + src/main/psxsdk/libc/a56.c | 3 + src/main/psxsdk/libc/a63.c | 3 + src/main/psxsdk/libc/c19.c | 3 + src/main/psxsdk/libc/c21.c | 3 + src/main/psxsdk/libc/c23.c | 4 +- src/main/psxsdk/libc/c24.c | 4 +- src/main/psxsdk/libc/c25.c | 3 + src/main/psxsdk/libc/c27.c | 3 + src/main/psxsdk/libc/c42.c | 3 + src/main/psxsdk/libc/c43.c | 3 + src/main/psxsdk/libc/c46.c | 3 + src/main/psxsdk/libc/c47.c | 3 + src/main/psxsdk/libc/c48.c | 3 + src/main/psxsdk/libc/c51.c | 3 + src/main/psxsdk/libc/c52.c | 3 + src/main/psxsdk/libc/c63.c | 3 + src/main/psxsdk/libcard/a74.c | 3 + src/main/psxsdk/libcard/a75.c | 3 + src/main/psxsdk/libcard/a78.c | 3 + src/main/psxsdk/libcard/a80.c | 3 + src/main/psxsdk/libcard/c171.c | 3 + src/main/psxsdk/libcard/c172.c | 3 + 61 files changed, 280 insertions(+), 60 deletions(-) create mode 100644 include/bios.h create mode 100644 src/main/psxsdk/libapi/a07.c create mode 100644 src/main/psxsdk/libapi/a08.c create mode 100644 src/main/psxsdk/libapi/a09.c create mode 100644 src/main/psxsdk/libapi/a10.c create mode 100644 src/main/psxsdk/libapi/a11.c create mode 100644 src/main/psxsdk/libapi/a12.c create mode 100644 src/main/psxsdk/libapi/a13.c create mode 100644 src/main/psxsdk/libapi/a20.c create mode 100644 src/main/psxsdk/libapi/a21.c create mode 100644 src/main/psxsdk/libapi/a22.c create mode 100644 src/main/psxsdk/libapi/a23.c create mode 100644 src/main/psxsdk/libapi/a24.c create mode 100644 src/main/psxsdk/libapi/a25.c create mode 100644 src/main/psxsdk/libapi/a36.c create mode 100644 src/main/psxsdk/libapi/a37.c create mode 100644 src/main/psxsdk/libapi/a50.c create mode 100644 src/main/psxsdk/libapi/a51.c create mode 100644 src/main/psxsdk/libapi/a52.c create mode 100644 src/main/psxsdk/libapi/a53.c create mode 100644 src/main/psxsdk/libapi/a54.c create mode 100644 src/main/psxsdk/libapi/a65.c create mode 100644 src/main/psxsdk/libapi/a66.c create mode 100644 src/main/psxsdk/libapi/a67.c create mode 100644 src/main/psxsdk/libapi/a69.c create mode 100644 src/main/psxsdk/libapi/a81.c create mode 100644 src/main/psxsdk/libapi/a91.c create mode 100644 src/main/psxsdk/libapi/c112.c create mode 100644 src/main/psxsdk/libapi/c114.c create mode 100644 src/main/psxsdk/libapi/c57.c create mode 100644 src/main/psxsdk/libapi/c66.c create mode 100644 src/main/psxsdk/libapi/c67.c create mode 100644 src/main/psxsdk/libapi/c68.c create mode 100644 src/main/psxsdk/libapi/c73.c create mode 100644 src/main/psxsdk/libapi/l10.c create mode 100644 src/main/psxsdk/libc/a56.c create mode 100644 src/main/psxsdk/libc/a63.c create mode 100644 src/main/psxsdk/libc/c19.c create mode 100644 src/main/psxsdk/libc/c21.c create mode 100644 src/main/psxsdk/libc/c25.c create mode 100644 src/main/psxsdk/libc/c27.c create mode 100644 src/main/psxsdk/libc/c42.c create mode 100644 src/main/psxsdk/libc/c43.c create mode 100644 src/main/psxsdk/libc/c46.c create mode 100644 src/main/psxsdk/libc/c47.c create mode 100644 src/main/psxsdk/libc/c48.c create mode 100644 src/main/psxsdk/libc/c51.c create mode 100644 src/main/psxsdk/libc/c52.c create mode 100644 src/main/psxsdk/libc/c63.c create mode 100644 src/main/psxsdk/libcard/a74.c create mode 100644 src/main/psxsdk/libcard/a75.c create mode 100644 src/main/psxsdk/libcard/a78.c create mode 100644 src/main/psxsdk/libcard/a80.c create mode 100644 src/main/psxsdk/libcard/c171.c create mode 100644 src/main/psxsdk/libcard/c172.c diff --git a/Makefile b/Makefile index f36238097..f83a3a54a 100644 --- a/Makefile +++ b/Makefile @@ -159,7 +159,7 @@ main_dirs: $(foreach dir,$(MAIN_ASM_DIRS) $(MAIN_SRC_DIRS),$(shell mkdir -p $(BUILD_DIR)/$(dir))) $(MAIN_TARGET).exe: $(MAIN_TARGET).elf $(OBJCOPY) -O binary $< $@ -$(MAIN_TARGET).elf: $(MAIN_O_FILES) +$(MAIN_TARGET).elf: $(MAIN_O_FILES) $(BUILD_DIR)/main.ld $(CONFIG_DIR)/undefined_syms.$(VERSION).txt $(CONFIG_DIR)/undefined_syms_auto.$(VERSION).$(MAIN).txt $(LD) $(LD_FLAGS) -o $@ \ -Map $(MAIN_TARGET).map \ -T $(BUILD_DIR)/main.ld \ diff --git a/config/splat.us.main.yaml b/config/splat.us.main.yaml index 7fd62a22d..fab18bfac 100644 --- a/config/splat.us.main.yaml +++ b/config/splat.us.main.yaml @@ -58,60 +58,61 @@ segments: - [0x1B4C, c, psxsdk/libgpu/font] - [0x2554, c, psxsdk/libgpu/prim] - [0x2C34, c, psxsdk/libgpu/sys] - - [0x5938, asm, psxsdk/libapi/c57] - - [0x5948, asm, psxsdk/libapi/c66] - - [0x5958, asm, psxsdk/libapi/c67] - - [0x5968, asm, psxsdk/libapi/c73] - - [0x5978, asm, psxsdk/libapi/c112] - - [0x5988, asm, psxsdk/libapi/a50] - - [0x5998, asm, psxsdk/libapi/a51] - - [0x59A8, asm, psxsdk/libapi/a52] - - [0x59B8, asm, psxsdk/libapi/a53] - - [0x59C8, asm, psxsdk/libapi/a54] - - [0x59D8, asm, psxsdk/libapi/a65] - - [0x59E8, asm, psxsdk/libapi/a66] - - [0x59F8, asm, psxsdk/libapi/a67] - - [0x5A08, asm, psxsdk/libapi/a69] - - [0x5A18, asm, psxsdk/libapi/a81] - - [0x5A28, asm, psxsdk/libapi/a91] + - [0x5938, c, psxsdk/libapi/c57] + - [0x5948, c, psxsdk/libapi/c66] + - [0x5958, c, psxsdk/libapi/c67] + - [0x5968, c, psxsdk/libapi/c73] + - [0x5978, c, psxsdk/libapi/c112] + - [0x5988, c, psxsdk/libapi/a50] + - [0x5998, c, psxsdk/libapi/a51] + - [0x59A8, c, psxsdk/libapi/a52] + - [0x59B8, c, psxsdk/libapi/a53] + - [0x59C8, c, psxsdk/libapi/a54] + - [0x59D8, c, psxsdk/libapi/a65] + - [0x59E8, c, psxsdk/libapi/a66] + - [0x59F8, c, psxsdk/libapi/a67] + - [0x5A08, c, psxsdk/libapi/a69] + - [0x5A18, c, psxsdk/libapi/a81] + - [0x5A28, c, psxsdk/libapi/a91] - [0x5A38, c, psxsdk/libetc/pad] - - [0x5AD8, asm, psxsdk/libapi/a20] - - [0x5AE8, asm, psxsdk/libapi/a21] - - [0x5AF8, asm, psxsdk/libapi/a22] - - [0x5CEC, asm, psxsdk/libapi/l10] + - [0x5AD8, c, psxsdk/libapi/a20] + - [0x5AE8, c, psxsdk/libapi/a21] + - [0x5AF8, c, psxsdk/libapi/a22] + - [0x5B08, asm, psxsdk/libetc/vsync] + - [0x5CEC, c, psxsdk/libapi/l10] - [0x5CFC, c, psxsdk/libetc/intr] - - [0x640C, asm, psxsdk/libapi/c114] - - [0x641C, asm, psxsdk/libapi/a23] - - [0x642C, asm, psxsdk/libapi/a24] - - [0x643C, asm, psxsdk/libapi/a25] - - [0x644C, asm, psxsdk/libapi/a36] - - [0x645C, asm, psxsdk/libapi/a37] + - [0x640C, c, psxsdk/libapi/c114] + - [0x641C, c, psxsdk/libapi/a23] + - [0x642C, c, psxsdk/libapi/a24] + - [0x643C, c, psxsdk/libapi/a25] + - [0x644C, c, psxsdk/libapi/a36] + - [0x645C, c, psxsdk/libapi/a37] - [0x646C, c, psxsdk/libetc/intr_vb] - [0x6594, c, psxsdk/libetc/intr_dma] - [0x683C, c, psxsdk/libetc/vmode] - - [0x6864, asm, psxsdk/libc/a56] - - [0x6874, asm, psxsdk/libc/a63] - - [0x6884, asm, psxsdk/libc/c19] - - [0x6894, asm, psxsdk/libc/c21] - - [0x68A4, asm, psxsdk/libc/c25] - - [0x68B4, asm, psxsdk/libc/c27] - - [0x68C4, asm, psxsdk/libc/c42] - - [0x68D4, asm, psxsdk/libc/c43] - - [0x68E4, asm, psxsdk/libc/c47] - - [0x68F4, asm, psxsdk/libc/c48] - - [0x6904, asm, psxsdk/libc/c51] - - [0x6914, asm, psxsdk/libc/c52] - - [0x6924, asm, psxsdk/libc/c63] + - [0x6864, c, psxsdk/libc/a56] + - [0x6874, c, psxsdk/libc/a63] + - [0x6884, c, psxsdk/libc/c19] + - [0x6894, c, psxsdk/libc/c21] + - [0x68A4, c, psxsdk/libc/c25] + - [0x68B4, c, psxsdk/libc/c27] + - [0x68C4, c, psxsdk/libc/c42] + - [0x68D4, c, psxsdk/libc/c43] + - [0x68E4, c, psxsdk/libc/c47] + - [0x68F4, c, psxsdk/libc/c48] + - [0x6904, c, psxsdk/libc/c51] + - [0x6914, c, psxsdk/libc/c52] + - [0x6924, c, psxsdk/libc/c63] - [0x6934, c, psxsdk/libc/sprintf] - - [0x7190, asm, psxsdk/libc/c46] + - [0x7190, c, psxsdk/libc/c46] - [0x71A0, c, psxsdk/libc/memmove] - - [0x720C, asm, psxsdk/libcard/c171] - - [0x721C, asm, psxsdk/libcard/c172] - - [0x722C, asm, psxsdk/libcard/a74] - - [0x723C, asm, psxsdk/libcard/a75] + - [0x720C, c, psxsdk/libcard/c171] + - [0x721C, c, psxsdk/libcard/c172] + - [0x722C, c, psxsdk/libcard/a74] + - [0x723C, c, psxsdk/libcard/a75] - [0x724C, c, psxsdk/libcard/card] - - [0x7284, asm, psxsdk/libcard/a78] - - [0x7294, asm, psxsdk/libcard/a80] + - [0x7284, c, psxsdk/libcard/a78] + - [0x7294, c, psxsdk/libcard/a80] - [0x72A4, c, psxsdk/libgs/gs_007] - [0x72DC, c, psxsdk/libapi/counter] - [0x7454, c, psxsdk/libgs/gs_008] @@ -154,10 +155,10 @@ segments: - [0x970C, c, psxsdk/libgte/fgo_06] - [0x98AC, c, psxsdk/libgte/ratan] - [0x9A2C, c, psxsdk/libgte/patchgte] - - [0x9ACC, asm, psxsdk/libapi/c68] + - [0x9ACC, c, psxsdk/libapi/c68] - [0x9ADC, c, psxsdk/libcd/cdrom] - [0x9B0C, c, psxsdk/libcd/event] - - [0x9C14, asm, psxsdk/libapi/a07] + - [0x9C14, c, psxsdk/libapi/a07] - [0x9C24, c, psxsdk/libcd/sys] - [0xA398, c, psxsdk/libcd/bios] - [0xBA98, c, psxsdk/libcd/iso9660] @@ -224,13 +225,13 @@ segments: - [0x12A0C, c, psxsdk/libsnd/vmanager] - [0x1785C, c, psxsdk/libspu/s_i] - [0x1787C, c, psxsdk/libspu/s_ini] - - [0x179C8, asm, psxsdk/libapi/a08] - - [0x179D8, asm, psxsdk/libapi/a12] + - [0x179C8, c, psxsdk/libapi/a08] + - [0x179D8, c, psxsdk/libapi/a12] - [0x179E8, c, psxsdk/libspu/spu] - [0x18B04, c, psxsdk/libspu/s_dcb] - [0x18B28, c, psxsdk/libspu/s_q] - - [0x18BA4, asm, psxsdk/libapi/a09] - - [0x18BB4, asm, psxsdk/libapi/a13] + - [0x18BA4, c, psxsdk/libapi/a09] + - [0x18BB4, c, psxsdk/libapi/a13] - [0x18BC4, c, psxsdk/libspu/s_m_init] - [0x18C18, c, psxsdk/libspu/s_m_m] - [0x191E0, c, psxsdk/libspu/s_m_wsa] @@ -241,7 +242,7 @@ segments: - [0x19A18, c, psxsdk/libspu/s_m_util] - [0x19B00, c, psxsdk/libspu/s_srmp] - [0x1A4E0, c, psxsdk/libspu/s_crwa] - - [0x1A67C, asm, psxsdk/libapi/a10] + - [0x1A67C, c, psxsdk/libapi/a10] - [0x1A68C, c, psxsdk/libspu/s_si] - [0x1A7BC, c, psxsdk/libspu/s_sic] - [0x1A800, c, psxsdk/libspu/s_cb] @@ -254,7 +255,7 @@ segments: - [0x1B3F4, c, psxsdk/libspu/s_stm] - [0x1B428, c, psxsdk/libspu/s_wp] - [0x1B4B4, c, psxsdk/libspu/s_itc] - - [0x1B55C, asm, psxsdk/libapi/a11] + - [0x1B55C, c, psxsdk/libapi/a11] - [0x1B56C, c, psxsdk/libspu/s_it] - [0x1B5A8, c, psxsdk/libspu/s_sca] - [0x1B93C, c, psxsdk/libspu/s_n2p] diff --git a/include/bios.h b/include/bios.h new file mode 100644 index 000000000..21d8d9fce --- /dev/null +++ b/include/bios.h @@ -0,0 +1,55 @@ +#ifndef BIOS_H +#define BIOS_H + +#include "common.h" + +// Defines the syscall stub for various functions +#define BIOS_FUNCTION(name, section, id) \ + __asm__( \ + ".pushsection .text\n" \ + "\t.align\t2\n" \ + "\t.globl\t" #name "\n" \ + "\t.ent\t" #name "\n" \ + "" #name " :\n" \ + ".set noat\n" \ + ".set noreorder\n" \ + "\n" \ + "glabel " #name "\n" \ + "\taddiu $t2, $zero, " #section "\n" \ + "\tjr $t2\n" \ + "\t addiu $t1, $zero, " #id "\n" \ + "\tnop\n" \ + ".size " #name ", . - " #name "\n" \ + "\t.set reorder\n" \ + "\t.set at\n" \ + "\t.end\t" #name "\n" \ + ".popsection"); + +#define BIOS_A_FUNCTION(name, id) BIOS_FUNCTION(name, 0xA0, id) + +#define BIOS_B_FUNCTION(name, id) BIOS_FUNCTION(name, 0xB0, id) + +#define BIOS_C_FUNCTION(name, id) BIOS_FUNCTION(name, 0xC0, id) + +#define SYSCALL(name, number) \ + __asm__( \ + ".pushsection .text\n" \ + "\t.align\t2\n" \ + "\t.globl\t" #name "\n" \ + "\t.ent\t" #name "\n" \ + "" #name " :\n" \ + ".set noat\n" \ + ".set noreorder\n" \ + "\n" \ + "glabel " #name "\n" \ + "\taddiu $a0, $zero, " #number "\n" \ + "\tsyscall 0\n" \ + "\tjr $ra\n" \ + "\tnop\n" \ + ".size " #name ", . - " #name "\n" \ + "\t.set reorder\n" \ + "\t.set at\n" \ + "\t.end\t" #name "\n" \ + ".popsection"); + +#endif // BIOS_H diff --git a/include/psxsdk/libapi.h b/include/psxsdk/libapi.h index 62dde4bb7..d950538d6 100644 --- a/include/psxsdk/libapi.h +++ b/include/psxsdk/libapi.h @@ -15,7 +15,7 @@ struct EXEC { unsigned long sp, fp, gp, ret, base; }; -extern void InitHeap(unsigned long*, unsigned long); +extern void InitHeap(void*, unsigned long); extern long Load(char*, struct EXEC*); extern long Exec(struct EXEC*, long, char**); // GPU_cw diff --git a/include/psxsdk/libc.h b/include/psxsdk/libc.h index e6ab8e35c..b33a78d03 100644 --- a/include/psxsdk/libc.h +++ b/include/psxsdk/libc.h @@ -2,6 +2,8 @@ extern void exit(); extern void puts(char*); // setjmp extern char* strcat(char*, char*); +extern int strcmp(char*, char*); +extern int strncmp(char*, char*); extern char* strcpy(char*, char*); extern int strlen(char*); extern void* memcpy(unsigned char*, unsigned char*, int); diff --git a/src/main/psxsdk/libapi/a07.c b/src/main/psxsdk/libapi/a07.c new file mode 100644 index 000000000..dadda127a --- /dev/null +++ b/src/main/psxsdk/libapi/a07.c @@ -0,0 +1,3 @@ +#include "bios.h" + +BIOS_B_FUNCTION(DeliverEvent, 0x7); diff --git a/src/main/psxsdk/libapi/a08.c b/src/main/psxsdk/libapi/a08.c new file mode 100644 index 000000000..a7f0e7295 --- /dev/null +++ b/src/main/psxsdk/libapi/a08.c @@ -0,0 +1,3 @@ +#include "bios.h" + +BIOS_B_FUNCTION(OpenEvent, 0x8); diff --git a/src/main/psxsdk/libapi/a09.c b/src/main/psxsdk/libapi/a09.c new file mode 100644 index 000000000..70ebb3c99 --- /dev/null +++ b/src/main/psxsdk/libapi/a09.c @@ -0,0 +1,3 @@ +#include "bios.h" + +BIOS_B_FUNCTION(CloseEvent, 0x9); diff --git a/src/main/psxsdk/libapi/a10.c b/src/main/psxsdk/libapi/a10.c new file mode 100644 index 000000000..597edafc6 --- /dev/null +++ b/src/main/psxsdk/libapi/a10.c @@ -0,0 +1,3 @@ +#include "bios.h" + +BIOS_B_FUNCTION(WaitEvent, 0xA); diff --git a/src/main/psxsdk/libapi/a11.c b/src/main/psxsdk/libapi/a11.c new file mode 100644 index 000000000..032fd4c36 --- /dev/null +++ b/src/main/psxsdk/libapi/a11.c @@ -0,0 +1,3 @@ +#include "bios.h" + +BIOS_B_FUNCTION(TestEvent, 0xB); diff --git a/src/main/psxsdk/libapi/a12.c b/src/main/psxsdk/libapi/a12.c new file mode 100644 index 000000000..dcdcda50e --- /dev/null +++ b/src/main/psxsdk/libapi/a12.c @@ -0,0 +1,3 @@ +#include "bios.h" + +BIOS_B_FUNCTION(EnableEvent, 0xC); diff --git a/src/main/psxsdk/libapi/a13.c b/src/main/psxsdk/libapi/a13.c new file mode 100644 index 000000000..1d27fce0e --- /dev/null +++ b/src/main/psxsdk/libapi/a13.c @@ -0,0 +1,3 @@ +#include "bios.h" + +BIOS_B_FUNCTION(DisableEvent, 0xD); diff --git a/src/main/psxsdk/libapi/a20.c b/src/main/psxsdk/libapi/a20.c new file mode 100644 index 000000000..6bf6e5747 --- /dev/null +++ b/src/main/psxsdk/libapi/a20.c @@ -0,0 +1,3 @@ +#include "bios.h" + +BIOS_B_FUNCTION(StopPAD, 0x14); diff --git a/src/main/psxsdk/libapi/a21.c b/src/main/psxsdk/libapi/a21.c new file mode 100644 index 000000000..1a124187f --- /dev/null +++ b/src/main/psxsdk/libapi/a21.c @@ -0,0 +1,3 @@ +#include "bios.h" + +BIOS_B_FUNCTION(PAD_init, 0x15); diff --git a/src/main/psxsdk/libapi/a22.c b/src/main/psxsdk/libapi/a22.c new file mode 100644 index 000000000..6a35ead86 --- /dev/null +++ b/src/main/psxsdk/libapi/a22.c @@ -0,0 +1,3 @@ +#include "bios.h" + +BIOS_B_FUNCTION(PAD_dr, 0x16); diff --git a/src/main/psxsdk/libapi/a23.c b/src/main/psxsdk/libapi/a23.c new file mode 100644 index 000000000..51bf64bd2 --- /dev/null +++ b/src/main/psxsdk/libapi/a23.c @@ -0,0 +1,3 @@ +#include "bios.h" + +BIOS_B_FUNCTION(ReturnFromException, 0x17); diff --git a/src/main/psxsdk/libapi/a24.c b/src/main/psxsdk/libapi/a24.c new file mode 100644 index 000000000..226694a6b --- /dev/null +++ b/src/main/psxsdk/libapi/a24.c @@ -0,0 +1,3 @@ +#include "bios.h" + +BIOS_B_FUNCTION(ResetEntryInt, 0x18); diff --git a/src/main/psxsdk/libapi/a25.c b/src/main/psxsdk/libapi/a25.c new file mode 100644 index 000000000..91c1940fb --- /dev/null +++ b/src/main/psxsdk/libapi/a25.c @@ -0,0 +1,3 @@ +#include "bios.h" + +BIOS_B_FUNCTION(HookEntryInt, 0x19); diff --git a/src/main/psxsdk/libapi/a36.c b/src/main/psxsdk/libapi/a36.c new file mode 100644 index 000000000..4598cae6a --- /dev/null +++ b/src/main/psxsdk/libapi/a36.c @@ -0,0 +1,3 @@ +#include "bios.h" + +SYSCALL(EnterCriticalSection, 0x1); diff --git a/src/main/psxsdk/libapi/a37.c b/src/main/psxsdk/libapi/a37.c new file mode 100644 index 000000000..57f31c8d7 --- /dev/null +++ b/src/main/psxsdk/libapi/a37.c @@ -0,0 +1,3 @@ +#include "bios.h" + +SYSCALL(ExitCriticalSection, 0x2); diff --git a/src/main/psxsdk/libapi/a50.c b/src/main/psxsdk/libapi/a50.c new file mode 100644 index 000000000..1ebb70d0e --- /dev/null +++ b/src/main/psxsdk/libapi/a50.c @@ -0,0 +1,3 @@ +#include "bios.h" + +BIOS_B_FUNCTION(open, 0x32); diff --git a/src/main/psxsdk/libapi/a51.c b/src/main/psxsdk/libapi/a51.c new file mode 100644 index 000000000..8e3d91505 --- /dev/null +++ b/src/main/psxsdk/libapi/a51.c @@ -0,0 +1,3 @@ +#include "bios.h" + +BIOS_B_FUNCTION(lseek, 0x33); diff --git a/src/main/psxsdk/libapi/a52.c b/src/main/psxsdk/libapi/a52.c new file mode 100644 index 000000000..488c42c2b --- /dev/null +++ b/src/main/psxsdk/libapi/a52.c @@ -0,0 +1,3 @@ +#include "bios.h" + +BIOS_B_FUNCTION(read, 0x34); diff --git a/src/main/psxsdk/libapi/a53.c b/src/main/psxsdk/libapi/a53.c new file mode 100644 index 000000000..b1a879c9d --- /dev/null +++ b/src/main/psxsdk/libapi/a53.c @@ -0,0 +1,3 @@ +#include "bios.h" + +BIOS_B_FUNCTION(write, 0x35); diff --git a/src/main/psxsdk/libapi/a54.c b/src/main/psxsdk/libapi/a54.c new file mode 100644 index 000000000..30209d29a --- /dev/null +++ b/src/main/psxsdk/libapi/a54.c @@ -0,0 +1,3 @@ +#include "bios.h" + +BIOS_B_FUNCTION(close, 0x36); diff --git a/src/main/psxsdk/libapi/a65.c b/src/main/psxsdk/libapi/a65.c new file mode 100644 index 000000000..638de2a40 --- /dev/null +++ b/src/main/psxsdk/libapi/a65.c @@ -0,0 +1,3 @@ +#include "bios.h" + +BIOS_B_FUNCTION(format, 0x41); diff --git a/src/main/psxsdk/libapi/a66.c b/src/main/psxsdk/libapi/a66.c new file mode 100644 index 000000000..988d4274e --- /dev/null +++ b/src/main/psxsdk/libapi/a66.c @@ -0,0 +1,3 @@ +#include "bios.h" + +BIOS_B_FUNCTION(firstfile, 0x42); diff --git a/src/main/psxsdk/libapi/a67.c b/src/main/psxsdk/libapi/a67.c new file mode 100644 index 000000000..7b9549446 --- /dev/null +++ b/src/main/psxsdk/libapi/a67.c @@ -0,0 +1,3 @@ +#include "bios.h" + +BIOS_B_FUNCTION(nextfile, 0x43); diff --git a/src/main/psxsdk/libapi/a69.c b/src/main/psxsdk/libapi/a69.c new file mode 100644 index 000000000..1a5005dca --- /dev/null +++ b/src/main/psxsdk/libapi/a69.c @@ -0,0 +1,3 @@ +#include "bios.h" + +BIOS_B_FUNCTION(erase, 0x45); diff --git a/src/main/psxsdk/libapi/a81.c b/src/main/psxsdk/libapi/a81.c new file mode 100644 index 000000000..ab0627fa7 --- /dev/null +++ b/src/main/psxsdk/libapi/a81.c @@ -0,0 +1,3 @@ +#include "bios.h" + +BIOS_B_FUNCTION(Krom2RawAdd, 0x51); diff --git a/src/main/psxsdk/libapi/a91.c b/src/main/psxsdk/libapi/a91.c new file mode 100644 index 000000000..784f76661 --- /dev/null +++ b/src/main/psxsdk/libapi/a91.c @@ -0,0 +1,3 @@ +#include "bios.h" + +BIOS_B_FUNCTION(ChangeClearPAD, 0x5B); diff --git a/src/main/psxsdk/libapi/c112.c b/src/main/psxsdk/libapi/c112.c new file mode 100644 index 000000000..b725cc9fd --- /dev/null +++ b/src/main/psxsdk/libapi/c112.c @@ -0,0 +1,3 @@ +#include "bios.h" + +BIOS_A_FUNCTION(_bu_init, 0x70); diff --git a/src/main/psxsdk/libapi/c114.c b/src/main/psxsdk/libapi/c114.c new file mode 100644 index 000000000..eac04fb33 --- /dev/null +++ b/src/main/psxsdk/libapi/c114.c @@ -0,0 +1,3 @@ +#include "bios.h" + +BIOS_A_FUNCTION(_96_remove, 0x72); diff --git a/src/main/psxsdk/libapi/c57.c b/src/main/psxsdk/libapi/c57.c new file mode 100644 index 000000000..c4c4e19c6 --- /dev/null +++ b/src/main/psxsdk/libapi/c57.c @@ -0,0 +1,3 @@ +#include "bios.h" + +BIOS_A_FUNCTION(InitHeap, 0x39); diff --git a/src/main/psxsdk/libapi/c66.c b/src/main/psxsdk/libapi/c66.c new file mode 100644 index 000000000..e93771553 --- /dev/null +++ b/src/main/psxsdk/libapi/c66.c @@ -0,0 +1,3 @@ +#include "bios.h" + +BIOS_A_FUNCTION(Load, 0x42); diff --git a/src/main/psxsdk/libapi/c67.c b/src/main/psxsdk/libapi/c67.c new file mode 100644 index 000000000..d34be3985 --- /dev/null +++ b/src/main/psxsdk/libapi/c67.c @@ -0,0 +1,3 @@ +#include "bios.h" + +BIOS_A_FUNCTION(Exec, 0x43); diff --git a/src/main/psxsdk/libapi/c68.c b/src/main/psxsdk/libapi/c68.c new file mode 100644 index 000000000..0b9c08fd0 --- /dev/null +++ b/src/main/psxsdk/libapi/c68.c @@ -0,0 +1,3 @@ +#include "bios.h" + +BIOS_A_FUNCTION(FlushCache, 0x44); diff --git a/src/main/psxsdk/libapi/c73.c b/src/main/psxsdk/libapi/c73.c new file mode 100644 index 000000000..9052ddb2f --- /dev/null +++ b/src/main/psxsdk/libapi/c73.c @@ -0,0 +1,3 @@ +#include "bios.h" + +BIOS_A_FUNCTION(GPU_cw, 0x49); diff --git a/src/main/psxsdk/libapi/l10.c b/src/main/psxsdk/libapi/l10.c new file mode 100644 index 000000000..1926e044a --- /dev/null +++ b/src/main/psxsdk/libapi/l10.c @@ -0,0 +1,3 @@ +#include "bios.h" + +BIOS_C_FUNCTION(ChangeClearRCnt, 0xA); diff --git a/src/main/psxsdk/libc/a56.c b/src/main/psxsdk/libc/a56.c new file mode 100644 index 000000000..429b3c682 --- /dev/null +++ b/src/main/psxsdk/libc/a56.c @@ -0,0 +1,3 @@ +#include "bios.h" + +BIOS_B_FUNCTION(exit, 0x38); diff --git a/src/main/psxsdk/libc/a63.c b/src/main/psxsdk/libc/a63.c new file mode 100644 index 000000000..fce96585a --- /dev/null +++ b/src/main/psxsdk/libc/a63.c @@ -0,0 +1,3 @@ +#include "bios.h" + +BIOS_B_FUNCTION(puts, 0x3F); diff --git a/src/main/psxsdk/libc/c19.c b/src/main/psxsdk/libc/c19.c new file mode 100644 index 000000000..f705c95ba --- /dev/null +++ b/src/main/psxsdk/libc/c19.c @@ -0,0 +1,3 @@ +#include "bios.h" + +BIOS_A_FUNCTION(setjmp, 0x13); diff --git a/src/main/psxsdk/libc/c21.c b/src/main/psxsdk/libc/c21.c new file mode 100644 index 000000000..96a2a1ce2 --- /dev/null +++ b/src/main/psxsdk/libc/c21.c @@ -0,0 +1,3 @@ +#include "bios.h" + +BIOS_A_FUNCTION(strcat, 0x15); diff --git a/src/main/psxsdk/libc/c23.c b/src/main/psxsdk/libc/c23.c index 20cd94779..7cc9f689f 100644 --- a/src/main/psxsdk/libc/c23.c +++ b/src/main/psxsdk/libc/c23.c @@ -1,3 +1,3 @@ -#include "common.h" +#include "bios.h" -INCLUDE_ASM("main/nonmatchings/psxsdk/libc/c23", strcmp); +BIOS_A_FUNCTION(strcmp, 0x17); diff --git a/src/main/psxsdk/libc/c24.c b/src/main/psxsdk/libc/c24.c index 769aed9db..4d3ffb14f 100644 --- a/src/main/psxsdk/libc/c24.c +++ b/src/main/psxsdk/libc/c24.c @@ -1,3 +1,3 @@ -#include "common.h" +#include "bios.h" -INCLUDE_ASM("main/nonmatchings/psxsdk/libc/c24", strncmp); +BIOS_A_FUNCTION(strncmp, 0x18); diff --git a/src/main/psxsdk/libc/c25.c b/src/main/psxsdk/libc/c25.c new file mode 100644 index 000000000..4c4af02d6 --- /dev/null +++ b/src/main/psxsdk/libc/c25.c @@ -0,0 +1,3 @@ +#include "bios.h" + +BIOS_A_FUNCTION(strcpy, 0x19); diff --git a/src/main/psxsdk/libc/c27.c b/src/main/psxsdk/libc/c27.c new file mode 100644 index 000000000..5124ccf8d --- /dev/null +++ b/src/main/psxsdk/libc/c27.c @@ -0,0 +1,3 @@ +#include "bios.h" + +BIOS_A_FUNCTION(strlen, 0x1B); diff --git a/src/main/psxsdk/libc/c42.c b/src/main/psxsdk/libc/c42.c new file mode 100644 index 000000000..b9b1c75aa --- /dev/null +++ b/src/main/psxsdk/libc/c42.c @@ -0,0 +1,3 @@ +#include "bios.h" + +BIOS_A_FUNCTION(memcpy, 0x2A); diff --git a/src/main/psxsdk/libc/c43.c b/src/main/psxsdk/libc/c43.c new file mode 100644 index 000000000..6c8972cfb --- /dev/null +++ b/src/main/psxsdk/libc/c43.c @@ -0,0 +1,3 @@ +#include "bios.h" + +BIOS_A_FUNCTION(memset, 0x2B); diff --git a/src/main/psxsdk/libc/c46.c b/src/main/psxsdk/libc/c46.c new file mode 100644 index 000000000..893fea906 --- /dev/null +++ b/src/main/psxsdk/libc/c46.c @@ -0,0 +1,3 @@ +#include "bios.h" + +BIOS_A_FUNCTION(memchr, 0x2E); diff --git a/src/main/psxsdk/libc/c47.c b/src/main/psxsdk/libc/c47.c new file mode 100644 index 000000000..8ff8f60ad --- /dev/null +++ b/src/main/psxsdk/libc/c47.c @@ -0,0 +1,3 @@ +#include "bios.h" + +BIOS_A_FUNCTION(rand, 0x2F); diff --git a/src/main/psxsdk/libc/c48.c b/src/main/psxsdk/libc/c48.c new file mode 100644 index 000000000..26bbb0c81 --- /dev/null +++ b/src/main/psxsdk/libc/c48.c @@ -0,0 +1,3 @@ +#include "bios.h" + +BIOS_A_FUNCTION(srand, 0x30); diff --git a/src/main/psxsdk/libc/c51.c b/src/main/psxsdk/libc/c51.c new file mode 100644 index 000000000..746b999f9 --- /dev/null +++ b/src/main/psxsdk/libc/c51.c @@ -0,0 +1,3 @@ +#include "bios.h" + +BIOS_A_FUNCTION(malloc, 0x33); diff --git a/src/main/psxsdk/libc/c52.c b/src/main/psxsdk/libc/c52.c new file mode 100644 index 000000000..ffb223730 --- /dev/null +++ b/src/main/psxsdk/libc/c52.c @@ -0,0 +1,3 @@ +#include "bios.h" + +BIOS_A_FUNCTION(free, 0x34); diff --git a/src/main/psxsdk/libc/c63.c b/src/main/psxsdk/libc/c63.c new file mode 100644 index 000000000..e324c411e --- /dev/null +++ b/src/main/psxsdk/libc/c63.c @@ -0,0 +1,3 @@ +#include "bios.h" + +BIOS_A_FUNCTION(printf, 0x3F); diff --git a/src/main/psxsdk/libcard/a74.c b/src/main/psxsdk/libcard/a74.c new file mode 100644 index 000000000..aaa65be08 --- /dev/null +++ b/src/main/psxsdk/libcard/a74.c @@ -0,0 +1,3 @@ +#include "bios.h" + +BIOS_B_FUNCTION(InitCARD, 0x4A); diff --git a/src/main/psxsdk/libcard/a75.c b/src/main/psxsdk/libcard/a75.c new file mode 100644 index 000000000..acef4a770 --- /dev/null +++ b/src/main/psxsdk/libcard/a75.c @@ -0,0 +1,3 @@ +#include "bios.h" + +BIOS_B_FUNCTION(StartCARD, 0x4B); diff --git a/src/main/psxsdk/libcard/a78.c b/src/main/psxsdk/libcard/a78.c new file mode 100644 index 000000000..b6beba251 --- /dev/null +++ b/src/main/psxsdk/libcard/a78.c @@ -0,0 +1,3 @@ +#include "bios.h" + +BIOS_B_FUNCTION(_card_write, 0x4E); diff --git a/src/main/psxsdk/libcard/a80.c b/src/main/psxsdk/libcard/a80.c new file mode 100644 index 000000000..b99d98eeb --- /dev/null +++ b/src/main/psxsdk/libcard/a80.c @@ -0,0 +1,3 @@ +#include "bios.h" + +BIOS_B_FUNCTION(_new_card, 0x50); diff --git a/src/main/psxsdk/libcard/c171.c b/src/main/psxsdk/libcard/c171.c new file mode 100644 index 000000000..95b43f880 --- /dev/null +++ b/src/main/psxsdk/libcard/c171.c @@ -0,0 +1,3 @@ +#include "bios.h" + +BIOS_A_FUNCTION(_card_info, 0xAB); diff --git a/src/main/psxsdk/libcard/c172.c b/src/main/psxsdk/libcard/c172.c new file mode 100644 index 000000000..af69deac2 --- /dev/null +++ b/src/main/psxsdk/libcard/c172.c @@ -0,0 +1,3 @@ +#include "bios.h" + +BIOS_A_FUNCTION(_card_load, 0xAC);