diff options
author | twinaphex | 2014-12-21 23:19:03 +0100 |
---|---|---|
committer | twinaphex | 2014-12-21 23:19:03 +0100 |
commit | e63a9dc66d0ce5a9d88353f880ef88a6590d06fd (patch) | |
tree | 6489b0d548ece33a4e92df40db442d839b934eb2 /libpcsxcore/psxbios.c | |
parent | 247fc699be6b3bd95fd9126541e0804cc8dffdd4 (diff) | |
parent | 5ec7acdfb1bc4c3da372f7f8e1a0a1022becce21 (diff) | |
download | pcsx_rearmed-e63a9dc66d0ce5a9d88353f880ef88a6590d06fd.tar.gz pcsx_rearmed-e63a9dc66d0ce5a9d88353f880ef88a6590d06fd.tar.bz2 pcsx_rearmed-e63a9dc66d0ce5a9d88353f880ef88a6590d06fd.zip |
Merge https://github.com/notaz/pcsx_rearmed
Diffstat (limited to 'libpcsxcore/psxbios.c')
-rw-r--r-- | libpcsxcore/psxbios.c | 39 |
1 files changed, 30 insertions, 9 deletions
diff --git a/libpcsxcore/psxbios.c b/libpcsxcore/psxbios.c index 04c959a..292d80d 100644 --- a/libpcsxcore/psxbios.c +++ b/libpcsxcore/psxbios.c @@ -613,14 +613,14 @@ void psxBios_tolower() { // 0x26 void psxBios_bcopy() { // 0x27 char *p1 = (char *)Ra1, *p2 = (char *)Ra0; - while (a2-- > 0) *p1++ = *p2++; + while ((s32)a2-- > 0) *p1++ = *p2++; pc0 = ra; } void psxBios_bzero() { // 0x28 char *p = (char *)Ra0; - while (a1-- > 0) *p++ = '\0'; + while ((s32)a1-- > 0) *p++ = '\0'; pc0 = ra; } @@ -630,7 +630,7 @@ void psxBios_bcmp() { // 0x29 if (a0 == 0 || a1 == 0) { v0 = 0; pc0 = ra; return; } - while (a2-- > 0) { + while ((s32)a2-- > 0) { if (*p1++ != *p2++) { v0 = *p1 - *p2; // BUG: compare the NEXT byte pc0 = ra; @@ -643,15 +643,16 @@ void psxBios_bcmp() { // 0x29 void psxBios_memcpy() { // 0x2a char *p1 = (char *)Ra0, *p2 = (char *)Ra1; - while (a2-- > 0) *p1++ = *p2++; + while ((s32)a2-- > 0) *p1++ = *p2++; v0 = a0; pc0 = ra; } void psxBios_memset() { // 0x2b char *p = (char *)Ra0; - while (a2-- > 0) *p++ = (char)a1; + while ((s32)a2-- > 0) *p++ = (char)a1; + a2 = 0; v0 = a0; pc0 = ra; } @@ -662,9 +663,9 @@ void psxBios_memmove() { // 0x2c a2++; // BUG: copy one more byte here p1 += a2; p2 += a2; - while (a2-- > 0) *--p1 = *--p2; + while ((s32)a2-- > 0) *--p1 = *--p2; } else { - while (a2-- > 0) *p1++ = *p2++; + while ((s32)a2-- > 0) *p1++ = *p2++; } v0 = a0; pc0 = ra; @@ -677,7 +678,7 @@ void psxBios_memcmp() { // 0x2d void psxBios_memchr() { // 0x2e char *p = (char *)Ra0; - while (a2-- > 0) { + while ((s32)a2-- > 0) { if (*p++ != (s8)a1) continue; v0 = a0 + (p - (char *)Ra0 - 1); pc0 = ra; @@ -1025,6 +1026,26 @@ _start: pc0 = ra; } +void psxBios_format() { // 0x41 + if (strcmp(Ra0, "bu00:") == 0 && Config.Mcd1[0] != '\0') + { + CreateMcd(Config.Mcd1); + LoadMcd(1, Config.Mcd1); + v0 = 1; + } + else if (strcmp(Ra0, "bu10:") == 0 && Config.Mcd2[0] != '\0') + { + CreateMcd(Config.Mcd2); + LoadMcd(2, Config.Mcd2); + v0 = 1; + } + else + { + v0 = 0; + } + pc0 = ra; +} + /* * long Load(char *name, struct EXEC *header); */ @@ -2521,7 +2542,7 @@ void psxBiosInit() { biosB0[0x3c] = psxBios_getchar; //biosB0[0x3e] = psxBios_gets; //biosB0[0x40] = psxBios_cd; - //biosB0[0x41] = psxBios_format; + biosB0[0x41] = psxBios_format; biosB0[0x42] = psxBios_firstfile; biosB0[0x43] = psxBios_nextfile; biosB0[0x44] = psxBios_rename; |