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; |
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 |
|
{ |
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); |
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); |
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); |
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; |
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; |
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 |
1081 |
|
{ |
1082 |
|
uaecptr pc = m68k_getpc (); |
1083 |
|
|
1067 |
– |
compiler_flush_jsr_stack (); |
1068 |
– |
|
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; |
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 */ |
1181 |
|
static int do_specialties (void) |
1182 |
|
{ |
1183 |
|
/*n_spcinsns++;*/ |
1169 |
– |
run_compiled_code(); |
1184 |
|
if (regs.spcflags & SPCFLAG_DOTRACE) { |
1185 |
|
Exception (9,last_trace_ad); |
1186 |
|
} |