This also implements a bug which allows writes to 0x400
(Is supposed to only accept sector number between 0..3FFh).
Function should return 0 if sector is invalid.
#ifdef PSXBIOS_LOG
PSXBIOS_LOG("psxBios_%s: %x,%x,%x\n", biosB0n[0x4e], a0, a1, a2);
#endif
-
+ /* Function also accepts sector 400h (a bug) */
+ if (!(a1 <= 0x400))
+ {
+ /* Invalid sectors */
+ v0 = 0; pc0 = ra;
+ return;
+ }
card_active_chan = a0;
port = a0 >> 4;
#ifdef PSXBIOS_LOG
PSXBIOS_LOG("psxBios_%s\n", biosB0n[0x4f]);
#endif
-
+ /* Function also accepts sector 400h (a bug) */
+ if (!(a1 <= 0x400))
+ {
+ /* Invalid sectors */
+ v0 = 0; pc0 = ra;
+ return;
+ }
card_active_chan = a0;
port = a0 >> 4;