diff --git a/SheepShaver/src/emul_op.cpp b/SheepShaver/src/emul_op.cpp index ba5de77f..2efe04ff 100644 --- a/SheepShaver/src/emul_op.cpp +++ b/SheepShaver/src/emul_op.cpp @@ -409,6 +409,16 @@ void EmulOp(M68kRegisters *r, uint32 pc, int selector) r->d[0] = (uint32)-7887; break; + case OP_CHECK_SYSV: { // Check we are not using MacOS < 8.1 with a NewWorld ROM + r->a[1] = r->d[1]; + r->a[0] = ReadMacInt32(r->d[1]); + uint32 sysv = ReadMacInt16(r->a[0]); + D(bug("Detected MacOS version %d.%d.%d\n", (sysv >> 8) & 0xf, (sysv >> 4) & 0xf, sysv & 0xf)); + if (ROMType == ROMTYPE_NEWWORLD && sysv < 0x0801) + r->d[1] = 0; + break; + } + case OP_NTRB_17_PATCH: r->a[2] = ReadMacInt32(r->a[7]); r->a[7] += 4; diff --git a/SheepShaver/src/include/emul_op.h b/SheepShaver/src/include/emul_op.h index 48cc3e70..5dfa72ed 100644 --- a/SheepShaver/src/include/emul_op.h +++ b/SheepShaver/src/include/emul_op.h @@ -47,7 +47,7 @@ enum { // Selectors for EMUL_OP opcodes OP_ADBOP, OP_INSTIME, OP_RMVTIME, OP_PRIMETIME, OP_MICROSECONDS, OP_PUT_SCRAP, OP_GET_SCRAP, OP_DEBUG_STR, OP_INSTALL_DRIVERS, OP_NAME_REGISTRY, OP_RESET, OP_IRQ, OP_SCSI_DISPATCH, OP_SCSI_ATOMIC, - OP_NTRB_17_PATCH, OP_NTRB_17_PATCH2, OP_NTRB_17_PATCH3, OP_NTRB_17_PATCH4, OP_CHECKLOAD, + OP_CHECK_SYSV, OP_NTRB_17_PATCH, OP_NTRB_17_PATCH2, OP_NTRB_17_PATCH3, OP_NTRB_17_PATCH4, OP_CHECKLOAD, OP_EXTFS_COMM, OP_EXTFS_HFS, OP_IDLE_TIME, OP_IDLE_TIME_2, OP_MAX }; @@ -96,6 +96,7 @@ const uint16 M68K_EMUL_OP_RESET = M68K_EMUL_BREAK + OP_RESET; const uint16 M68K_EMUL_OP_IRQ = M68K_EMUL_BREAK + OP_IRQ; const uint16 M68K_EMUL_OP_SCSI_DISPATCH = M68K_EMUL_BREAK + OP_SCSI_DISPATCH; const uint16 M68K_EMUL_OP_SCSI_ATOMIC = M68K_EMUL_BREAK + OP_SCSI_ATOMIC; +const uint16 M68K_EMUL_OP_CHECK_SYSV = M68K_EMUL_BREAK + OP_CHECK_SYSV; const uint16 M68K_EMUL_OP_NTRB_17_PATCH = M68K_EMUL_BREAK + OP_NTRB_17_PATCH; const uint16 M68K_EMUL_OP_NTRB_17_PATCH2 = M68K_EMUL_BREAK + OP_NTRB_17_PATCH2; const uint16 M68K_EMUL_OP_NTRB_17_PATCH3 = M68K_EMUL_BREAK + OP_NTRB_17_PATCH3; diff --git a/SheepShaver/src/rsrc_patches.cpp b/SheepShaver/src/rsrc_patches.cpp index 9c4ea127..e1a1a8e9 100644 --- a/SheepShaver/src/rsrc_patches.cpp +++ b/SheepShaver/src/rsrc_patches.cpp @@ -168,6 +168,12 @@ void CheckLoad(uint32 type, int16 id, uint16 *p, uint32 size) p[5] = htons(0x6010); // bra D(bug(" patch 7 applied\n")); } + } else if (PM(0,0x2f3c) && PM(1,0x7665) && PM(2,0x7273) && PM(3,0x3f3c) && PM(4,0x0001) && PM(10,0x2041) && PM(11,0x2248) && PM(12,0x2050) && PM(20,0x7066) && PM(21,0xa9c9)) { + // Check when vers 1 is installed (for safe abort if MacOS < 8.1 is used with a NewWorld ROM) + p[10] = htons(M68K_EMUL_OP_CHECK_SYSV); + p[11] = htons(0x4a81); // tst.l d1 + p[12] = htons(0x670e); // beq.s + D(bug(" patch 9 applied\n")); } p++; }