1
/**********************************/
3
/* Copyright 2000, David Grant */
5
/* see LICENSE for more details */
7
/**********************************/
9
/* FIXME: Unverified correct operation */
16
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
17
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
18
| 1 | 0 | 1 | 1 | Register | OPmode | EA Mode |EA Register|
19
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
23
int EORTime[8]={1, 3, 3, 3, 3, 4, 3, -1};
26
INSTRUCTION_5ARGS(EOR,
31
unsigned EARegister,3);
33
static void execute(void)
35
struct _Address Source,Destination;
36
unsigned int Result, SValue, DValue;
38
Memory_RetrWordFromPC(&Instr.Code);
40
if(Instr.Bits.OPMode==2) { /* <EA>y ^ Dx */
41
if(Instr.Bits.EAMode==1) {
42
ERR("May not specify Ax for source");
45
if(!EA_GetFromPC(&Source, 32, Instr.Bits.EAMode, Instr.Bits.EARegister)) return;
46
if(!EA_GetFromPC(&Destination, 32, 0, Instr.Bits.Register)) return;
47
} else if (Instr.Bits.OPMode==6) { /* Dy & <EA>x -> <EA>x */
49
if(Instr.Bits.EAMode==0) {
50
ERR("May not specify Dx for destination when source is Dx");
52
} else if (Instr.Bits.EAMode==1) {
53
ERR("May not specify Ax for destination when source is Dx");
55
} else */ if (Instr.Bits.EAMode==7 && Instr.Bits.EARegister==4) {
56
ERR("May not specify Immediate Addressing for destination");
59
if(!EA_GetFromPC(&Source, 32, 0, Instr.Bits.Register)) return;
60
if(!EA_GetFromPC(&Destination, 32, Instr.Bits.EAMode, Instr.Bits.EARegister)) return;
62
ERR("Unknown OPMode %d", Instr.Bits.OPMode);
66
EA_GetValue(&SValue, &Source);
67
EA_GetValue(&DValue, &Destination);
69
Result = SValue ^ DValue;
71
EA_PutValue(&Destination, Result);
73
/* Set the status register
75
* N - set if MSB or result is 1
76
* Z - set if result is zero
79
memory_core.sr &= 0xFFF0;
80
SRBits->N = ((int)Result < 0);
81
SRBits->Z = (Result == 0);
83
cycle(EORTime[cycle_EA(Instr.Bits.EARegister,Instr.Bits.EAMode)]);
88
static int disassemble(char *Instruction, char *Arg1, char *Arg2)
91
Memory_RetrWordFromPC(&Instr.Code);
92
sprintf(Instruction, "EOR.L");
93
if(Instr.Bits.OPMode==2) { /* <EA>y ^ Dx */
94
Addressing_Print(32, Instr.Bits.EAMode, Instr.Bits.EARegister, Arg1);
95
Addressing_Print(32, 0, Instr.Bits.Register, Arg2);
97
Addressing_Print(32, 0, Instr.Bits.Register, Arg1);
98
Addressing_Print(32, Instr.Bits.EAMode, Instr.Bits.EARegister, Arg2);
103
int eor_5206_register(void)
105
instruction_register(0xB180, 0xF1C0, &execute, &disassemble);