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

Comparing BasiliskII/src/AmigaOS/main_amiga.cpp (file contents):
Revision 1.6 by cebix, 2000-07-06T16:04:24Z vs.
Revision 1.9 by jlachmann, 2000-08-20T14:08:41Z

# Line 75 | Line 75 | uint32 ROMBaseMac;             // ROM base (Mac add
75   uint8 *ROMBaseHost;             // ROM base (host address space)
76   uint32 ROMSize;                 // Size of ROM
77  
78 + uint32 MacsBugFlags = 0xbff;
79 +
80  
81   // CPU and FPU type, addressing mode
82   int CPUType;
# Line 242 | Line 244 | int main(void)
244                  WarningAlert(GetString(STR_SMALL_RAM_WARN));
245                  RAMSize = 1024*1024;
246          }
247 <        RAMBaseHost = (uint8 *)AllocMem(RAMSize + 0x100000, MEMF_PUBLIC);
248 <        if (RAMBaseHost == NULL) {
249 <                ErrorAlert(GetString(STR_NO_MEM_ERR));
250 <                QuitEmulator();
251 <        }
247 >        RAMBaseHost = (uint8 *)AllocVec(RAMSize + 0x100000, MEMF_PUBLIC);
248 > //      if (RAMBaseHost == NULL) {
249 > //              ErrorAlert(GetString(STR_NO_MEM_ERR));
250 > //              QuitEmulator();
251 > //      }
252 >        if (RAMBaseHost == NULL)
253 >                {
254 >                uint32 newRAMSize = AvailMem(MEMF_LARGEST) - 0x100000;
255 >                char xText[120];
256 >
257 >                sprintf(xText, GetString(STR_NOT_ENOUGH_MEM_WARN), RAMSize, newRAMSize);
258 >
259 >                if (1 != ChoiceAlert(xText, "Use", "Quit"))
260 >                        QuitEmulator();
261 >
262 >                RAMSize = newRAMSize;
263 >                RAMBaseHost = (uint8 *)AllocVec(RAMSize + 0x100000, MEMF_PUBLIC);
264 >                if (RAMBaseHost == NULL) {
265 >                        ErrorAlert(GetString(STR_NO_MEM_ERR));
266 >                        QuitEmulator();
267 >                }
268 >                }
269          RAMBaseMac = (uint32)RAMBaseHost;
270          D(bug("Mac RAM starts at %08lx\n", RAMBaseHost));
271          ROMBaseHost = RAMBaseHost + RAMSize;
# Line 313 | Line 332 | int main(void)
332          // Set task priority to -1 so we don't use all processing time
333          SetTaskPri(MainTask, -1);
334  
335 +        WriteMacInt32(MacsBugFlags, 0);
336 +
337          // Swap stack to Mac RAM area
338          stack_swap.stk_Lower = RAMBaseHost;
339          stack_swap.stk_Upper = (ULONG)RAMBaseHost + RAMSize;
# Line 347 | Line 368 | void __saveds quit_emulator(void)
368  
369   void QuitEmulator(void)
370   {
371 +        // Stop 60Hz thread
372 +        if (tick_proc) {
373 +                SetSignal(0, SIGF_SINGLE);
374 +                tick_proc_active = false;
375 +                Wait(SIGF_SINGLE);
376 +        }
377 +
378          // Restore stack
379          if (stack_swapped) {
380                  stack_swapped = false;
# Line 360 | Line 388 | void QuitEmulator(void)
388                  FreeSignal(IRQSig);
389          }
390  
363        // Stop 60Hz thread
364        if (tick_proc) {
365                SetSignal(0, SIGF_SINGLE);
366                tick_proc_active = false;
367                Wait(SIGF_SINGLE);
368        }
369
391          // Remove trap handler
392          MainTask->tc_TrapCode = OldTrapHandler;
393  
# Line 375 | Line 396 | void QuitEmulator(void)
396  
397          // Delete RAM/ROM area
398          if (RAMBaseHost)
399 <                FreeMem(RAMBaseHost, RAMSize + 0x100000);
399 >                FreeVec(RAMBaseHost);
400  
401          // Delete scratch memory area
402          if (ScratchMem)
# Line 453 | Line 474 | void TriggerInterrupt(void)
474          Signal(MainTask, IRQSigMask);
475   }
476  
477 + void TriggerNMI(void)
478 + {
479 +        AsmTriggerNMI();
480 + }
481 +
482  
483   /*
484   *  60Hz thread
# Line 495 | Line 521 | static __saveds void tick_func(void)
521                  if (++tick_counter > 60) {
522                          tick_counter = 0;
523                          WriteMacInt32(0x20c, TimerDateTime());
524 +                        SetInterruptFlag(INTFLAG_1HZ);
525 +                        TriggerInterrupt();
526                  }
527  
528                  // Trigger 60Hz interrupt
# Line 608 | Line 636 | void __saveds IllInstrHandler(trap_regs
636                  EmulatedSR |= 0x0700;
637  
638                  // Call opcode routine
639 <                EmulOp(*(uint16 *)(r->pc), (M68kRegisters *)r);
639 >                EmulOp(opcode, (M68kRegisters *)r);
640                  r->pc += 2;
641  
642                  // Restore interrupts

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines