ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/SheepShaver/src/emul_op.cpp
(Generate patch)

Comparing SheepShaver/src/emul_op.cpp (file contents):
Revision 1.2 by gbeauche, 2003-09-07T14:33:51Z vs.
Revision 1.9 by gbeauche, 2004-05-15T16:36:41Z

# Line 1 | Line 1
1   /*
2   *  emul_op.cpp - 68k opcodes for ROM patches
3   *
4 < *  SheepShaver (C) 1997-2002 Christian Bauer and Marc Hellwig
4 > *  SheepShaver (C) 1997-2004 Christian Bauer and Marc Hellwig
5   *
6   *  This program is free software; you can redistribute it and/or modify
7   *  it under the terms of the GNU General Public License as published by
# Line 45 | Line 45
45   #include "name_registry.h"
46   #include "user_strings.h"
47   #include "emul_op.h"
48 + #include "thunks.h"
49  
50   #define DEBUG 0
51   #include "debug.h"
# Line 257 | Line 258 | void EmulOp(M68kRegisters *r, uint32 pc,
258                          // Install drivers
259                          InstallDrivers();
260  
260 #if !EMULATED_PPC
261                          // Patch MakeExecutable()
262                          MakeExecutableTvec = (uint32 *)FindLibSymbol("\023PrivateInterfaceLib", "\016MakeExecutable");
263                          D(bug("MakeExecutable TVECT at %p\n", MakeExecutableTvec));
264 < #ifdef __BEOS__
265 <                        MakeExecutableTvec[0] = ((uint32 *)MakeExecutable)[0];
266 < #else
267 <                        MakeExecutableTvec[0] = (uint32)MakeExecutable;
268 < #endif
264 >                        MakeExecutableTvec[0] = htonl(NativeFunction(NATIVE_MAKE_EXECUTABLE));
265 > #if !EMULATED_PPC
266                          MakeExecutableTvec[1] = (uint32)TOC;
267   #endif
268  
269                          // Patch DebugStr()
270 <                        static const uint8 proc[] = {
271 <                                M68K_EMUL_OP_DEBUG_STR >> 8, M68K_EMUL_OP_DEBUG_STR & 0xff,
272 <                                0x4e, 0x74,                     // rtd  #4
273 <                                0x00, 0x04
270 >                        static const uint16 proc[] = {
271 >                                PW(M68K_EMUL_OP_DEBUG_STR),
272 >                                PW(0x4e74),                     // rtd  #4
273 >                                PW(0x0004)
274                          };
275                          WriteMacInt32(0x1dfc, (uint32)proc);
276                          break;
# Line 310 | Line 307 | void EmulOp(M68kRegisters *r, uint32 pc,
307   #if !PRECISE_TIMING
308                                          TimerInterrupt();
309   #endif
313 #if EMULATED_PPC
310                                          ExecuteNative(NATIVE_VIDEO_VBL);
315 #else
316                                        ExecutePPC(VideoVBL);
317 #endif
311  
312                                          static int tick_counter = 0;
313                                          if (++tick_counter >= 60) {
# Line 332 | Line 325 | void EmulOp(M68kRegisters *r, uint32 pc,
325                                  }
326                                  if (InterruptFlags & INTFLAG_ETHER) {
327                                          ClearInterruptFlag(INTFLAG_ETHER);
335 #if EMULATED_PPC
328                                          ExecuteNative(NATIVE_ETHER_IRQ);
337 #else
338                                        ExecutePPC(EtherIRQ);
339 #endif
329                                  }
330                                  if (InterruptFlags & INTFLAG_TIMER) {
331                                          ClearInterruptFlag(INTFLAG_TIMER);
# Line 467 | Line 456 | void EmulOp(M68kRegisters *r, uint32 pc,
456                          break;
457  
458                  case OP_IDLE_TIME:
470 #if __BEOS__
459                          // Sleep if no events pending
460 <                        if (ReadMacInt32(0x14c) == 0) {
461 <                                sleep(16667);
474 <                        }
475 < #endif
460 >                        if (ReadMacInt32(0x14c) == 0)
461 >                                Delay_usec(16667);
462                          r->a[0] = ReadMacInt32(0x2b6);
463                          break;
464  
465 +                case OP_IDLE_TIME_2:
466 +                        // Sleep if no events pending
467 +                        if (ReadMacInt32(0x14c) == 0)
468 +                                Delay_usec(16667);
469 +                        r->d[0] = (uint32)-2;
470 +                        break;
471 +
472                  default:
473                          printf("FATAL: EMUL_OP called with bogus selector %08x\n", selector);
474                          QuitEmulator();

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines