OpenCores
URL https://opencores.org/ocsvn/open8_urisc/open8_urisc/trunk

Subversion Repositories open8_urisc

[/] [open8_urisc/] [trunk/] [Open8 Tools/] [open8_src/] [open8_as/] [decode_v8urisc.c] - Blame information for rev 239

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 178 jshamlet
 
2
    case 0:
3
      for ( ; x < OP_SIZE_MAX; inz++, x++) {
4
        if (opt_tmp->op[x] == 0 && buffer[inz] == 0x0A) {
5
          fprintf(file_out_ptr, "d%d ", opt_tmp->hex);
6
          i = inz;
7
          return SUCCEEDED;
8
        }
9
        if (opt_tmp->op[x] != toupper((int)buffer[inz]))
10
          break;
11
      }
12
      break;
13
 
14
    case 1:
15
      if (xbit_size > 8 && opt_tmp->skip_8bit == 1)
16
        break;
17
      for ( ; x < OP_SIZE_MAX; inz++, x++) {
18
        if (opt_tmp->op[x] == 'x') {
19
          y = i;
20
          i = inz;
21
          z = input_number();
22
          inz = i;
23
          i = y;
24
          if (!(z == SUCCEEDED || z == INPUT_NUMBER_ADDRESS_LABEL || z == INPUT_NUMBER_STACK))
25
            return FAILED;
26
          if (z == SUCCEEDED && (d > 255 || d < -128))
27
            break;
28
          if (operand_hint == HINT_16BIT)
29
            break;
30
 
31
          for (x++ ; x < OP_SIZE_MAX; inz++, x++) {
32
            if (opt_tmp->op[x] == 0 && buffer[inz] == 0x0A) {
33
              if (z == SUCCEEDED)
34
                fprintf(file_out_ptr, "d%d d%d ", opt_tmp->hex, d);
35
              else if (z == INPUT_NUMBER_ADDRESS_LABEL)
36
                fprintf(file_out_ptr, "k%d d%d R%s ", active_file_info_last->line_current, opt_tmp->hex, label);
37
              else
38
                fprintf(file_out_ptr, "d%d c%d ", opt_tmp->hex, latest_stack);
39
 
40
              i = inz;
41
              return SUCCEEDED;
42
            }
43
            if (opt_tmp->op[x] != toupper((int)buffer[inz]))
44
              break;
45
          }
46
        }
47
        if (opt_tmp->op[x] != toupper((int)buffer[inz]))
48
          break;
49
      }
50
      break;
51
 
52
    case 2:
53
      for ( ; x < OP_SIZE_MAX; inz++, x++) {
54
        if (opt_tmp->op[x] == '?') {
55
          y = i;
56
          i = inz;
57
          z = input_number();
58
          inz = i;
59
          i = y;
60
          if (!(z == SUCCEEDED || z == INPUT_NUMBER_ADDRESS_LABEL || z == INPUT_NUMBER_STACK))
61
            return FAILED;
62
          if (z == SUCCEEDED && (d > 65535 || d < -32768)) {
63
            print_error("Out of 16bit range.\n", ERROR_NUM);
64
            return FAILED;
65
          }
66
 
67
          for (x++ ; x < OP_SIZE_MAX; inz++, x++) {
68
            if (opt_tmp->op[x] == 0 && buffer[inz] == 0x0A) {
69
              if (z == SUCCEEDED)
70
                fprintf(file_out_ptr, "d%d y%d ", opt_tmp->hex, d);
71
              else if (z == INPUT_NUMBER_ADDRESS_LABEL)
72
                fprintf(file_out_ptr, "k%d d%d r%s ", active_file_info_last->line_current, opt_tmp->hex, label);
73
              else
74
                fprintf(file_out_ptr, "d%d C%d ", opt_tmp->hex, latest_stack);
75
 
76
              i = inz;
77
              return SUCCEEDED;
78
            }
79
            if (opt_tmp->op[x] != toupper((int)buffer[inz]))
80
              break;
81
          }
82
        }
83
        if (opt_tmp->op[x] != toupper((int)buffer[inz]))
84
          break;
85
      }
86
      break;
87
 
88
    case 3:
89
      for ( ; x < OP_SIZE_MAX; inz++, x++) {
90
        if (opt_tmp->op[x] == 0 && buffer[inz] == 0x0A) {
91
          fprintf(file_out_ptr, "y%d ", opt_tmp->hex);
92
          i = inz;
93
          return SUCCEEDED;
94
        }
95
        if (opt_tmp->op[x] != toupper((int)buffer[inz]))
96
          break;
97
      }
98
      break;
99
 
100
    case 4:
101
      if (xbit_size > 8 && opt_tmp->skip_8bit == 1)
102
        break;
103
      for ( ; x < OP_SIZE_MAX; inz++, x++) {
104
        if (opt_tmp->op[x] == 'x') {
105
          y = i;
106
          i = inz;
107
          z = input_number();
108
          inz = i;
109
          i = y;
110
 
111
          if (!(z == SUCCEEDED || z == INPUT_NUMBER_ADDRESS_LABEL || z == INPUT_NUMBER_STACK))
112
            return FAILED;
113
          if (z == SUCCEEDED && (d > 255 || d < -128))
114
            break;
115
          if (operand_hint == HINT_16BIT)
116
            break;
117
 
118
          for (x++ ; x < OP_SIZE_MAX; inz++, x++) {
119
            if (opt_tmp->op[x] == 0 && buffer[inz] == 0x0A) {
120
              if (z == SUCCEEDED)
121
                fprintf(file_out_ptr, "d%d d%d ", opt_tmp->hex, d);
122
              else if (z == INPUT_NUMBER_ADDRESS_LABEL)
123
                fprintf(file_out_ptr, "k%d d%d Q%s ", active_file_info_last->line_current, opt_tmp->hex, label);
124
              else
125
                fprintf(file_out_ptr, "d%d c%d ", opt_tmp->hex, latest_stack);
126
 
127
              i = inz;
128
              return SUCCEEDED;
129
            }
130
            if (opt_tmp->op[x] != toupper((int)buffer[inz]))
131
              break;
132
          }
133
        }
134
        if (opt_tmp->op[x] != toupper((int)buffer[inz]))
135
          break;
136
      }
137
      break;

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.