comparison src/lwasm.c @ 32:9bd0fbfe7405

Added basic indexed mode handling
author lost
date Fri, 02 Jan 2009 04:22:39 +0000
parents f736579569b4
children 538e15927776
comparison
equal deleted inserted replaced
31:674ee393426c 32:9bd0fbfe7405
97 (*str)++; 97 (*str)++;
98 else 98 else
99 (*str) += 2; 99 (*str) += 2;
100 return rval; 100 return rval;
101 } 101 }
102
103 int lwasm_lookupreg3(const char *rlist, const char **str)
104 {
105 int rval = 0;
106 int f = 0;
107 const char *reglist = rlist;
108
109 while (*reglist)
110 {
111 if (toupper(**str) == *reglist)
112 {
113 // first char matches
114 if (reglist[1] == ' ')
115 {
116 f = 1;
117 break;
118 }
119 if (toupper(*(*str + 1)) == reglist[1])
120 {
121 // second char matches
122 if (reglist[2] == ' ')
123 {
124 f = 1;
125 break;
126 }
127 if (toupper(*(*str + 2)) == reglist[2])
128 {
129 f = 1;
130 break;
131 }
132 }
133 }
134 reglist += 3;
135 rval++;
136 }
137 if (f == 0)
138 return -1;
139
140
141 reglist = rval * 3 + rlist;
142 if (reglist[1] == ' ')
143 (*str) += 1;
144 else if (reglist[2] == ' ')
145 (*str) += 2;
146 else
147 (*str)+=3;
148 return rval;
149 }