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

Comparing BasiliskII/src/uae_cpu/newcpu.cpp (file contents):
Revision 1.5 by cebix, 1999-11-03T10:56:43Z vs.
Revision 1.9 by gbeauche, 2001-07-13T10:13:58Z

# Line 22 | Line 22 | extern int intlev(void);       // From baisili
22   #include "memory.h"
23   #include "readcpu.h"
24   #include "newcpu.h"
25 #include "compiler.h"
25  
26   int quit_program = 0;
27   int debugging = 0;
# Line 207 | Line 206 | void init_m68k (void)
206      do_merges ();
207  
208      build_cpufunctbl ();
209 +    
210 +    fpu_init ();
211 +    fpu_set_integral_fpu (CPUType == 4);
212 + }
213 +
214 + void exit_m68k (void)
215 + {
216 +        fpu_exit ();
217   }
218  
219   struct regstruct regs, lastint_regs;
# Line 215 | Line 222 | static int backup_pointer = 0;
222   static long int m68kpc_offset;
223   int lastint_no;
224  
225 + #if REAL_ADDRESSING || DIRECT_ADDRESSING
226 + #define get_ibyte_1(o) get_byte(get_virtual_address(regs.pc_p) + (o) + 1)
227 + #define get_iword_1(o) get_word(get_virtual_address(regs.pc_p) + (o))
228 + #define get_ilong_1(o) get_long(get_virtual_address(regs.pc_p) + (o))
229 + #else
230   #define get_ibyte_1(o) get_byte(regs.pc + (regs.pc_p - regs.pc_oldp) + (o) + 1)
231   #define get_iword_1(o) get_word(regs.pc + (regs.pc_p - regs.pc_oldp) + (o))
232   #define get_ilong_1(o) get_long(regs.pc + (regs.pc_p - regs.pc_oldp) + (o))
233 + #endif
234  
235   uae_s32 ShowEA (int reg, amodes mode, wordsizes size, char *buf)
236   {
# Line 645 | Line 658 | void MakeFromSR (void)
658  
659   void Exception(int nr, uaecptr oldpc)
660   {
661 <    compiler_flush_jsr_stack();
661 >    uae_u32 currpc = m68k_getpc ();
662      MakeSR();
663      if (!regs.s) {
664          regs.usp = m68k_areg(regs, 7);
# Line 674 | Line 687 | void Exception(int nr, uaecptr oldpc)
687              m68k_areg(regs, 7) -= 2;
688              put_word (m68k_areg(regs, 7), nr * 4);
689              m68k_areg(regs, 7) -= 4;
690 <            put_long (m68k_areg(regs, 7), m68k_getpc ());
690 >            put_long (m68k_areg(regs, 7), currpc);
691              m68k_areg(regs, 7) -= 2;
692              put_word (m68k_areg(regs, 7), regs.sr);
693              regs.sr |= (1 << 13);
# Line 700 | Line 713 | void Exception(int nr, uaecptr oldpc)
713          }
714      }
715      m68k_areg(regs, 7) -= 4;
716 <    put_long (m68k_areg(regs, 7), m68k_getpc ());
716 >    put_long (m68k_areg(regs, 7), currpc);
717   kludge_me_do:
718      m68k_areg(regs, 7) -= 2;
719      put_word (m68k_areg(regs, 7), regs.sr);
# Line 723 | Line 736 | static void Interrupt(int nr)
736  
737   static int caar, cacr, tc, itt0, itt1, dtt0, dtt1;
738  
739 < void m68k_move2c (int regno, uae_u32 *regp)
739 > int m68k_move2c (int regno, uae_u32 *regp)
740   {
741 <    if (CPUType == 1 && (regno & 0x7FF) > 1)
741 >  if ((CPUType == 1 && (regno & 0x7FF) > 1)
742 >  || (CPUType < 4 && (regno & 0x7FF) > 2)
743 >  || (CPUType == 4 && regno == 0x802))
744 >  {
745          op_illg (0x4E7B);
746 <    else
746 >        return 0;
747 >  } else {
748          switch (regno) {
749           case 0: regs.sfc = *regp & 7; break;
750           case 1: regs.dfc = *regp & 7; break;
751 <         case 2: cacr = *regp & 0x3; break;     /* ignore C and CE */
751 >         case 2: cacr = *regp & (CPUType < 4 ? 0x3 : 0x80008000); break;
752           case 3: tc = *regp & 0xc000; break;
753           case 4: itt0 = *regp & 0xffffe364; break;
754           case 5: itt1 = *regp & 0xffffe364; break;
# Line 744 | Line 761 | void m68k_move2c (int regno, uae_u32 *re
761           case 0x804: regs.isp = *regp; if (regs.m == 0) m68k_areg(regs, 7) = regs.isp; break;
762           default:
763              op_illg (0x4E7B);
764 <            break;
764 >            return 0;
765          }
766 +  }
767 +  return 1;
768   }
769  
770 < void m68k_movec2 (int regno, uae_u32 *regp)
770 > int m68k_movec2 (int regno, uae_u32 *regp)
771   {
772 <    if (CPUType == 1 && (regno & 0x7FF) > 1)
772 >    if ((CPUType == 1 && (regno & 0x7FF) > 1)
773 >        || (CPUType < 4 && (regno & 0x7FF) > 2)
774 >        || (CPUType == 4 && regno == 0x802))
775 >    {
776          op_illg (0x4E7A);
777 <    else
777 >        return 0;
778 >    } else {
779          switch (regno) {
780           case 0: *regp = regs.sfc; break;
781           case 1: *regp = regs.dfc; break;
# Line 769 | Line 792 | void m68k_movec2 (int regno, uae_u32 *re
792           case 0x804: *regp = regs.m == 0 ? m68k_areg(regs, 7) : regs.isp; break;
793           default:
794              op_illg (0x4E7A);
795 <            break;
795 >            return 0;
796 >        }
797          }
798 +        return 1;
799   }
800  
801   static __inline__ int
# Line 1047 | Line 1072 | void m68k_reset (void)
1072      regs.spcflags = 0;
1073      regs.intmask = 7;
1074      regs.vbr = regs.sfc = regs.dfc = 0;
1075 <    regs.fpcr = regs.fpsr = regs.fpiar = 0;
1075 >    /* gb-- moved into {fpp,fpu_x86}.cpp::fpu_init()
1076 >    regs.fpcr = regs.fpsr = regs.fpiar = 0; */
1077 >    fpu_reset();
1078   }
1079  
1080   void REGPARAM2 op_illg (uae_u32 opcode)
1081   {
1082      uaecptr pc = m68k_getpc ();
1083  
1057    compiler_flush_jsr_stack ();
1058
1084          if ((opcode & 0xFF00) == 0x7100) {
1085                  struct M68kRegisters r;
1086                  int i;
1087  
1088 <                // Return from Execute68k()?
1088 >                // Return from Exectue68k()?
1089                  if (opcode == M68K_EXEC_RETURN) {
1090                          regs.spcflags |= SPCFLAG_BRK;
1091                          quit_program = 1;
# Line 1119 | Line 1144 | static uaecptr last_trace_ad = 0;
1144  
1145   static void do_trace (void)
1146   {
1147 <    if (regs.t0) {
1147 >    if (regs.t0 && CPUType >= 2) {
1148         uae_u16 opcode;
1149         /* should also include TRAP, CHK, SR modification FPcc */
1150         /* probably never used so why bother */
# Line 1156 | Line 1181 | static void do_trace (void)
1181   static int do_specialties (void)
1182   {
1183      /*n_spcinsns++;*/
1159    run_compiled_code();
1184      if (regs.spcflags & SPCFLAG_DOTRACE) {
1185          Exception (9,last_trace_ad);
1186      }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines