summaryrefslogtreecommitdiff
path: root/libpcsxcore
diff options
context:
space:
mode:
authorSND\weimingzhi_cp <SND\weimingzhi_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97>2011-01-19 03:59:33 +0000
committerSND\weimingzhi_cp <SND\weimingzhi_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97>2011-01-19 03:59:33 +0000
commit11504d854a44435f1d80d760161b7e04c1d9d7eb (patch)
tree4c6b2b0b5468e9b4db52e207efe726ccd58beba6 /libpcsxcore
parente9d5b096735ea6dc46085535130d4e512225869f (diff)
downloadpcsxr-11504d854a44435f1d80d760161b7e04c1d9d7eb.tar.gz
notaz:
- fix firstfile() return value - it should only return dir when finds a match, and bufile macro already does that. (Patch #8118). - firstfile delivers an event on real bios, so do that (Patch #8119). - implement psxBios__card_chan (Patch #8120). git-svn-id: https://pcsxr.svn.codeplex.com/svn/pcsxr@62183 e17a0e51-4ae3-4d35-97c3-1a29b211df97
Diffstat (limited to 'libpcsxcore')
-rw-r--r--libpcsxcore/psxbios.c30
1 files changed, 22 insertions, 8 deletions
diff --git a/libpcsxcore/psxbios.c b/libpcsxcore/psxbios.c
index f77b809e..c10f8a1b 100644
--- a/libpcsxcore/psxbios.c
+++ b/libpcsxcore/psxbios.c
@@ -21,8 +21,6 @@
* Internal simulated HLE BIOS.
*/
-// TODO: implement all system calls, count the exact CPU cycles of system calls.
-
#include "psxbios.h"
#include "psxhw.h"
@@ -256,6 +254,7 @@ static int CardState = -1;
static TCB Thread[8];
static int CurThread = 0;
static FileDesc FDesc[32];
+static u32 card_active_chan = 0;
boolean hleSoftCall = FALSE;
@@ -1239,6 +1238,8 @@ void psxBios__card_info() { // ab
PSXBIOS_LOG("psxBios_%s: %x\n", biosA0n[0xab], a0);
#endif
+ card_active_chan = a0;
+
// DeliverEvent(0x11, 0x2); // 0xf0000011, 0x0004
DeliverEvent(0x81, 0x2); // 0xf4000001, 0x0004
@@ -1250,6 +1251,8 @@ void psxBios__card_load() { // ac
PSXBIOS_LOG("psxBios_%s: %x\n", biosA0n[0xac], a0);
#endif
+ card_active_chan = a0;
+
// DeliverEvent(0x11, 0x2); // 0xf0000011, 0x0004
DeliverEvent(0x81, 0x2); // 0xf4000001, 0x0004
@@ -1868,14 +1871,13 @@ void psxBios_firstfile() { // 42
nfile = 1;
if (!strncmp(Ra0, "bu00", 4)) {
bufile(1);
- v0 = _dir;
- }
-
- if (!strncmp(Ra0, "bu10", 4)) {
+ } else if (!strncmp(Ra0, "bu10", 4)) {
bufile(2);
- v0 = _dir;
}
+ // firstfile() calls _card_read() internally, so deliver it's event
+ DeliverEvent(0x11, 0x2);
+
pc0 = ra;
}
@@ -2024,6 +2026,7 @@ void psxBios__card_write() { // 0x4e
PSXBIOS_LOG("psxBios_%s: %x,%x,%x\n", biosB0n[0x4e], a0, a1, a2);
#endif
+ card_active_chan = a0;
port = a0 >> 4;
if (port == 0) {
@@ -2047,6 +2050,7 @@ void psxBios__card_read() { // 0x4f
PSXBIOS_LOG("psxBios_%s\n", biosB0n[0x4f]);
#endif
+ card_active_chan = a0;
port = a0 >> 4;
if (port == 0) {
@@ -2128,6 +2132,15 @@ void psxBios_GetB0Table() { // 57
v0 = 0x874; pc0 = ra;
}
+void psxBios__card_chan() { // 0x58
+#ifdef PSXBIOS_LOG
+ PSXBIOS_LOG("psxBios_%s\n", biosB0n[0x58]);
+#endif
+
+ v0 = card_active_chan;
+ pc0 = ra;
+}
+
void psxBios_ChangeClearPad() { // 5b
#ifdef PSXBIOS_LOG
PSXBIOS_LOG("psxBios_%s: %x\n", biosB0n[0x5b], a0);
@@ -2485,7 +2498,7 @@ void psxBiosInit() {
//biosB0[0x55] = psxBios__get_error;
biosB0[0x56] = psxBios_GetC0Table;
biosB0[0x57] = psxBios_GetB0Table;
- //biosB0[0x58] = psxBios__card_chan;
+ biosB0[0x58] = psxBios__card_chan;
//biosB0[0x59] = psxBios_sys_b0_59;
//biosB0[0x5a] = psxBios_sys_b0_5a;
biosB0[0x5b] = psxBios_ChangeClearPad;
@@ -2820,4 +2833,5 @@ void psxBiosFreeze(int Mode) {
bfreezes(Thread);
bfreezel(&CurThread);
bfreezes(FDesc);
+ bfreezel(&card_active_chan);
}