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

Comparing BasiliskII/src/uae_cpu/basilisk_glue.cpp (file contents):
Revision 1.1.1.1 by cebix, 1999-10-03T14:16:26Z vs.
Revision 1.20 by gbeauche, 2008-01-01T09:40:35Z

# Line 1 | Line 1
1   /*
2   *  basilisk_glue.cpp - Glue UAE CPU to Basilisk II CPU engine interface
3   *
4 < *  Basilisk II (C) 1997-1999 Christian Bauer
4 > *  Basilisk II (C) 1997-2008 Christian Bauer
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 19 | Line 19
19   */
20  
21   #include "sysdeps.h"
22 +
23   #include "cpu_emulation.h"
24   #include "main.h"
25 + #include "prefs.h"
26   #include "emul_op.h"
27   #include "rom_patches.h"
28 + #include "timer.h"
29   #include "m68k.h"
30   #include "memory.h"
31   #include "readcpu.h"
32   #include "newcpu.h"
33 < #include "compiler.h"
33 > #include "compiler/compemu.h"
34  
35  
36   // RAM and ROM pointers
37 < uint32 RAMBaseMac;                      // RAM base (Mac address space)
37 > uint32 RAMBaseMac = 0;          // RAM base (Mac address space) gb-- initializer is important
38   uint8 *RAMBaseHost;                     // RAM base (host address space)
39   uint32 RAMSize;                         // Size of RAM
40   uint32 ROMBaseMac;                      // ROM base (Mac address space)
# Line 45 | Line 48 | uint32 MacFrameSize;           // Size of frame b
48   int MacFrameLayout;                     // Frame buffer layout
49   #endif
50  
51 + #if DIRECT_ADDRESSING
52 + uintptr MEMBaseDiff;            // Global offset between a Mac address and its Host equivalent
53 + #endif
54 +
55 + #if USE_JIT
56 + bool UseJIT = false;
57 + #endif
58 +
59   // From newcpu.cpp
60 < extern int quit_program;
60 > extern bool quit_program;
61  
62  
63   /*
# Line 57 | Line 68 | bool Init680x0(void)
68   {
69   #if REAL_ADDRESSING
70          // Mac address space = host address space
71 <        RAMBaseMac = (uint32)RAMBaseHost;
72 <        ROMBaseMac = (uint32)ROMBaseHost;
71 >        RAMBaseMac = (uintptr)RAMBaseHost;
72 >        ROMBaseMac = (uintptr)ROMBaseHost;
73 > #elif DIRECT_ADDRESSING
74 >        // Mac address space = host address space minus constant offset (MEMBaseDiff)
75 >        // NOTE: MEMBaseDiff is set up in main_unix.cpp/main()
76 >        RAMBaseMac = 0;
77 >        ROMBaseMac = Host2MacAddr(ROMBaseHost);
78   #else
79          // Initialize UAE memory banks
80          RAMBaseMac = 0;
# Line 81 | Line 97 | bool Init680x0(void)
97   #endif
98  
99          init_m68k();
100 + #if USE_JIT
101 +        UseJIT = compiler_use_jit();
102 +        if (UseJIT)
103 +            compiler_init();
104 + #endif
105          return true;
106   }
107  
# Line 91 | Line 112 | bool Init680x0(void)
112  
113   void Exit680x0(void)
114   {
115 + #if USE_JIT
116 +    if (UseJIT)
117 +        compiler_exit();
118 + #endif
119 +        exit_m68k();
120   }
121  
122  
123   /*
124 + *  Initialize memory mapping of frame buffer (called upon video mode change)
125 + */
126 +
127 + void InitFrameBufferMapping(void)
128 + {
129 + #if !REAL_ADDRESSING && !DIRECT_ADDRESSING
130 +        memory_init();
131 + #endif
132 + }
133 +
134 + /*
135   *  Reset and start 680x0 emulation (doesn't return)
136   */
137  
138   void Start680x0(void)
139   {
140          m68k_reset();
141 <        m68k_go(true);
141 > #if USE_JIT
142 >    if (UseJIT)
143 >        m68k_compile_execute();
144 >    else
145 > #endif
146 >        m68k_execute();
147   }
148  
149  
# Line 111 | Line 153 | void Start680x0(void)
153  
154   void TriggerInterrupt(void)
155   {
156 <        regs.spcflags |= SPCFLAG_INT;
156 >        idle_resume();
157 >        SPCFLAGS_SET( SPCFLAG_INT );
158 > }
159 >
160 > void TriggerNMI(void)
161 > {
162 >        //!! not implemented yet
163   }
164  
165  
# Line 152 | Line 200 | void Execute68kTrap(uint16 trap, struct
200          // Execute trap
201          m68k_setpc(m68k_areg(regs, 7));
202          fill_prefetch_0();
203 <        quit_program = 0;
204 <        m68k_go(true);
203 >        quit_program = false;
204 >        m68k_execute();
205  
206          // Clean up stack
207          m68k_areg(regs, 7) += 4;
# Line 167 | Line 215 | void Execute68kTrap(uint16 trap, struct
215                  r->d[i] = m68k_dreg(regs, i);
216          for (i=0; i<7; i++)
217                  r->a[i] = m68k_areg(regs, i);
218 <        quit_program = 0;
218 >        quit_program = false;
219   }
220  
221  
# Line 199 | Line 247 | void Execute68k(uint32 addr, struct M68k
247          // Execute routine
248          m68k_setpc(addr);
249          fill_prefetch_0();
250 <        quit_program = 0;
251 <        m68k_go(true);
250 >        quit_program = false;
251 >        m68k_execute();
252  
253          // Clean up stack
254          m68k_areg(regs, 7) += 2;
# Line 214 | Line 262 | void Execute68k(uint32 addr, struct M68k
262                  r->d[i] = m68k_dreg(regs, i);
263          for (i=0; i<7; i++)
264                  r->a[i] = m68k_areg(regs, i);
265 <        quit_program = 0;
265 >        quit_program = false;
266   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines