summaryrefslogtreecommitdiff
path: root/sim/h8500/inst.h
blob: 328ca945a89fc28dc5080d6de0a7c722e0a46a13 (plain)
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
#define DEBUG

#define H8500_MSIZE (8*64*1024)
#define CSIZE 1000


union rtype 
    {
      unsigned long l;
      unsigned short s[2];
      unsigned char *c;
    };


/* Local register names */
typedef enum
{
  R0, R1, R2, R3, R4, R5, R6, R7,
  R_SR,				/* 8 */
  R_PC,				/* 9 */
  R_BR,				/* 10 */
  R_BP,				/* 11 */
  R_CP,				/* 14 */
  R_DP,				/* 13 */
  R_EP,				/* 12 */
  R_TP,				/* 15 */
  R_HARD_0,			/* 16 */
  R_HARD8_0,			/* 17 */
  R_LAST,
} reg_type;




typedef struct
{
  fastref type;
  union
    {
      int code;
      unsigned char *bptr;
      unsigned short *wptr;
      unsigned long *lptr;
      unsigned char **segptr;
      union rtype *rptr;
      
    }
  reg;
  int literal;
  union
    {
      unsigned char **segreg;
      unsigned short *wptr;
      union rtype *rptr;
    }
  r2;
}

ea_type;



typedef struct
{
  ea_type srca;
  ea_type srcb;
  ea_type dst;
  fastref opcode;
  fastref flags;
  int next_pc;
  int oldpc;
  int cycles;
#ifdef DEBUG
  h8500_opcode_info *op;
#endif
}

decoded_inst;



typedef struct
{
  int exception;
  union rtype   regs[20];
  


  unsigned char *memory;
  unsigned short *cache_idx;
  int cache_top;
  int maximum;
  int csize;
  decoded_inst *cache;
  int cycles;
  int insts;
  int ticks;
  int compiles;
}

cpu_state_type;