ref: d902d0e899a7e69fc1b159db45d2e283cc6f3a51
parent: 5139c2e98511dfeb47b909e1dee53ab5106eba14
author: mkf <mkf@cloud9p.org>
date: Thu Jul 4 05:34:59 EDT 2024
5551a: remove
--- a/5551a.c
+++ /dev/null
@@ -1,80 +1,0 @@
-#include <stdbool.h>
-#include <stdio.h>
-#include <string.h>
-
-#include "5551.h"
-
-
-int main(int argc, char* argv[])
-{
- unsigned int inst, a, b, c;
- char string[32], op[4];
- while(scanf("%s %[^\n;]%*c", op, string) > 0)
- {
- sscanf(string, "%u %u %u", &a, &b, &c);
- if(!strcmp(op, "DIE"))
- inst = DIE;
- if(!strcmp(op, "OUT"))
- inst = OUT;
- if(!strcmp(op, "NOT"))
- inst = NOT;
- if(!strcmp(op, "AND"))
- inst = AND;
- if(!strcmp(op, "NOR"))
- inst = NOR;
- if(!strcmp(op, "XOR"))
- inst = XOR;
- if(!strcmp(op, "SUB"))
- inst = SUB;
- if(!strcmp(op, "ADD"))
- inst = ADD;
- if(!strcmp(op, "SHR"))
- inst = SHR;
- if(!strcmp(op, "SHL"))
- inst = SHL;
- if(!strcmp(op, "PUT"))
- inst = PUT;
- if(!strcmp(op, "MOV"))
- inst = MOV;
- if(!strcmp(op, "LDM"))
- inst = LDM;
- if(!strcmp(op, "NTH"))
- inst = NTH;
-
- switch(inst)
- {
- /* no args */
- case DIE:
- printf("%u\n", inst);
- break;
- /* one arg */
- case NOT:
- case OUT:
- printf("%u %u\n", inst, a);
- break;
- /* two args */
- case PUT:
- case MOV:
- case LDM:
- printf("%u %u %u\n", inst, a, b);
- break;
- /* three args */
- case AND:
- case NOR:
- case XOR:
- case SUB:
- case SHL:
- case SHR:
- case ADD:
- case NTH:
- printf("%u %u %u %u\n", inst, a, b, c);
- break;
- /* should this ever happen? */
- default:
- fprintf(stderr, "unkown instr.\n");
- return -1;
-
- }
- }
- return 0;
-}