1
/**********************************/
3
/* Copyright 2000, David Grant */
5
/* see LICENSE for more details */
7
/**********************************/
11
/* Clear (CLR) instruction */
15
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
16
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
17
| 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | Size | EAMode |EARegister |
18
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
22
int CLRTime[8]={ 1, 1, 1, 1, 1, 2, 1, -1};
25
INSTRUCTION_4ARGS(CLR,
29
unsigned EARegister,3);
31
const short CLR_SizeBits[4]={ 8 , 16 , 32 , 0 };
32
const char CLR_SizeStr[4]= {'B', 'W', 'L', '?'};
34
static void execute(void)
36
struct _Address Destination;
39
Memory_RetrWordFromPC(&Instr.Code);
42
if(Instr.Bits.Size == 3) {
43
ERR("Invalid size=3", memory_core.pc);
47
if(!EA_GetFromPC(&Destination, CLR_SizeBits[(short)Instr.Bits.Size], Instr.Bits.EAMode, Instr.Bits.EARegister)) return;
48
EA_PutValue(&Destination, 0);
60
cycle(CLRTime[cycle_EA(Instr.Bits.EARegister,Instr.Bits.EAMode)]);
64
static int disassemble(char *Instruction, char *Arg1, char *Arg2)
67
Memory_RetrWordFromPC(&Instr.Code);
69
sprintf(Instruction, "CLR.%c", CLR_SizeStr[(short)Instr.Bits.Size]);
71
Addressing_Print(CLR_SizeBits[(short)Instr.Bits.Size], Instr.Bits.EAMode, Instr.Bits.EARegister, Arg1);
77
int clr_5206_register(void)
79
instruction_register(0x4200, 0xFF00, &execute, &disassemble);