~ubuntu-branches/ubuntu/lucid/skyeye/lucid

« back to all changes in this revision

Viewing changes to arch/coldfire/i_5206/i_negx.c

  • Committer: Bazaar Package Importer
  • Author(s): Yu Guanghui
  • Date: 2006-08-09 16:30:44 UTC
  • Revision ID: james.westby@ubuntu.com-20060809163044-6efqjm0t2stau23w
Tags: upstream-1.2.0rc8
ImportĀ upstreamĀ versionĀ 1.2.0rc8

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/**********************************/
 
2
/*                                */
 
3
/*  Copyright 2000, David Grant   */
 
4
/*                                */
 
5
/*  see LICENSE for more details  */
 
6
/*                                */
 
7
/**********************************/
 
8
 
 
9
#include "coldfire.h"
 
10
 
 
11
/* Negate with Excend (NEGX) instruction */
 
12
 
 
13
/* Format 
 
14
   
 
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 | 0 | 0 | 1 | 0 | 0 | 0 | 0 |  Register |
 
18
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
 
19
 
 
20
*/
 
21
 
 
22
int NEGXTime=1;
 
23
 
 
24
 
 
25
INSTRUCTION_2ARGS(NEGX,
 
26
        unsigned Code1,13,
 
27
        unsigned Register,3);
 
28
 
 
29
static void execute(void)
 
30
{
 
31
        struct _Address Destination;
 
32
        unsigned int Result, DValue;
 
33
        NEGX_Instr Instr;
 
34
 
 
35
        Memory_RetrWordFromPC(&Instr.Code);
 
36
 
 
37
        if(!EA_GetFromPC(&Destination, 32, 0, Instr.Bits.Register)) return;
 
38
        EA_GetValue(&DValue, &Destination);
 
39
 
 
40
        Result = 0 - DValue - (unsigned int)SRBits->X;
 
41
 
 
42
 
 
43
        SR_Set(I_NEGX, 0, DValue, Result);
 
44
 
 
45
        EA_PutValue(&Destination, Result);
 
46
 
 
47
        cycle(NEGXTime);
 
48
        
 
49
        return;
 
50
}
 
51
 
 
52
static int disassemble(char *Instruction, char *Arg1, char *Arg2) 
 
53
{
 
54
        NEGX_Instr Instr;
 
55
        Memory_RetrWordFromPC(&Instr.Code);
 
56
 
 
57
        sprintf(Instruction, "NEGX.L");
 
58
        Addressing_Print(32, 0, Instr.Bits.Register, Arg1);
 
59
        Arg2[0]=0;
 
60
        return 0;
 
61
}
 
62
 
 
63
int negx_5206_register(void)
 
64
{
 
65
        instruction_register(0x4080, 0xFFF8, &execute, &disassemble);
 
66
        return 1;
 
67
}