Commit bafce57ad94cdb761215b37db6c586a13da44c9c

Authored by Imanol-Mikel Barba Sabariego
1 parent 746fe14d

more intelligent decoding

Showing 1 changed file with 11 additions and 62 deletions
@@ -245,88 +245,37 @@ void decode_instruction(uint16_t opcode, uint16_t *arg1, uint16_t *arg2, uint16_ @@ -245,88 +245,37 @@ void decode_instruction(uint16_t opcode, uint16_t *arg1, uint16_t *arg2, uint16_
245 switch(opcode) 245 switch(opcode)
246 { 246 {
247 case HALT: 247 case HALT:
248 - break;  
249 - case MOV:  
250 - *arg1 = fetch();  
251 - *arg2 = fetch(); 248 + case RET:
  249 + case NOP:
252 break; 250 break;
253 case PUSH: 251 case PUSH:
254 - *arg1 = fetch();  
255 - break;  
256 case POP: 252 case POP:
257 - *arg1 = fetch();  
258 - break;  
259 - case TEQ:  
260 - *arg1 = fetch();  
261 - *arg2 = fetch();  
262 - *arg3 = fetch();  
263 - break;  
264 - case TGT:  
265 - *arg1 = fetch();  
266 - *arg2 = fetch();  
267 - *arg3 = fetch();  
268 - break;  
269 case JMP: 253 case JMP:
  254 + case CALL:
  255 + case OUT:
  256 + case IN:
270 *arg1 = fetch(); 257 *arg1 = fetch();
271 break; 258 break;
  259 + case MOV:
272 case JNZ: 260 case JNZ:
273 - *arg1 = fetch();  
274 - *arg2 = fetch();  
275 - break;  
276 case JZ: 261 case JZ:
  262 + case NOT:
  263 + case LOAD:
  264 + case STOR:
277 *arg1 = fetch(); 265 *arg1 = fetch();
278 *arg2 = fetch(); 266 *arg2 = fetch();
279 break; 267 break;
  268 + case TEQ:
  269 + case TGT:
280 case ADD: 270 case ADD:
281 - *arg1 = fetch();  
282 - *arg2 = fetch();  
283 - *arg3 = fetch();  
284 - break;  
285 case MUL: 271 case MUL:
286 - *arg1 = fetch();  
287 - *arg2 = fetch();  
288 - *arg3 = fetch();  
289 - break;  
290 case MOD: 272 case MOD:
291 - *arg1 = fetch();  
292 - *arg2 = fetch();  
293 - *arg3 = fetch();  
294 - break;  
295 case AND: 273 case AND:
296 - *arg1 = fetch();  
297 - *arg2 = fetch();  
298 - *arg3 = fetch();  
299 - break;  
300 case OR: 274 case OR:
301 *arg1 = fetch(); 275 *arg1 = fetch();
302 *arg2 = fetch(); 276 *arg2 = fetch();
303 *arg3 = fetch(); 277 *arg3 = fetch();
304 break; 278 break;
305 - case NOT:  
306 - *arg1 = fetch();  
307 - *arg2 = fetch();  
308 - break;  
309 - case LOAD:  
310 - *arg1 = fetch();  
311 - *arg2 = fetch();  
312 - break;  
313 - case STOR:  
314 - *arg1 = fetch();  
315 - *arg2 = fetch();  
316 - break;  
317 - case CALL:  
318 - *arg1 = fetch();  
319 - break;  
320 - case RET:  
321 - break;  
322 - case OUT:  
323 - *arg1 = fetch();  
324 - break;  
325 - case IN:  
326 - *arg1 = fetch();  
327 - break;  
328 - case NOP:  
329 - break;  
330 default: 279 default:
331 break; 280 break;
332 } 281 }