1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76
|
/**********************************/
/* */
/* Copyright 2000, David Grant */
/* */
/* see LICENSE for more details */
/* */
/**********************************/
#include "coldfire.h"
/* Move instruction */
/* Format
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
| 0 | 1 | 1 | 1 | Register | 0 | Data |
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
*/
int MOVEQTime=1;
INSTRUCTION_4ARGS(MOVEQ,
unsigned Code2,4,
unsigned Register,3,
unsigned Code1,1,
signed Data,8);
static void execute(void)
{
struct _Address Destination;
unsigned long SValue;
MOVEQ_Instr Instr;
Memory_RetrWordFromPC(&Instr.Code);
SValue=(unsigned long)Instr.Bits.Data;
if(!EA_GetFromPC(&Destination, 32, 0, Instr.Bits.Register)) return;
EA_PutValue(&Destination, SValue);
/* X - not affected
N - set if result is -ve, cleared otherwise
Z - set if result is zero, cleared otherwise
V - always cleared
C - always cleared */
/* Set the status register */
memory_core.sr &= 0xFFF0;
SRBits->N = ((long)SValue < 0);
SRBits->Z = (SValue == 0);
cycle(MOVEQTime);
return;
}
static long disassemble(char *Instruction, char *Arg1, char *Arg2)
{
MOVEQ_Instr Instr;
Memory_RetrWordFromPC(&Instr.Code);
sprintf(Instruction, "MOVEQ");
sprintf(Arg1, "#0x%02X", ((char)Instr.Bits.Data) & 0x000000FF);
Addressing_Print(32, 0, Instr.Bits.Register, Arg2);
return 0;
}
long moveq_5206_register(void)
{
instruction_register(0x7000, 0xF100, &execute, &disassemble);
return 1;
}
|