Help me with this exam

Create a program for interpretation of a simple instruction set consisting of the instructions: MVI, MOV, AND, OR, NOT, LESS, LEQ, GRE, GEQ, JMP, PRN, SUM, SUB, PRB, SL and SR . Your task is to make a program that takes as an input a binary representation of a list of instructions, and as an output it prints the corresponding result (after the execution of the instructions). The input can contain all the instructions except SUM and PRB that you do not have to implement. Conversion from binary system to any other numeral system should not be made, except at the moment when you need to find the line that should be executed next when the condition is satisfied (GRE, GEQ, LESS, LEQ, JMP), but the comparison of the numbers in the condition should be made based on the binary representation. All data are represented in DC binary system. There are eight 16-bit registers available enumerated from 0 to 7.


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
 #include<iostream>
#include<stdio.h>
#define MAX 1000
using namespace std;

char registers[8][16];

void MVI(int reg, char *value) {
    // your code here
}

void MOV(int reg1, int reg2) {
    // your code here
}

void AND(int reg1, int reg2, int reg3) {
    // your code here
}

void OR(int reg1, int reg2, int reg3) {
    // your code here
}

void NOT(int reg1, int reg2) {
    // your code here
}

void PRN(int reg) {
    // your code here
}

void SUB(int reg1, int reg2, int reg3) {
    // your code here
}

void SL(int reg) {
    // your code here
}

void SR(int reg) {
    // your code here
}

int main() {
    int i,j,k;
    int N = 0;  // number of lines in the input
    char c;
    char lines[MAX][16];

    while (1) {
        scanf("%c", &c);
        if (c == '\n') {
            break;
        }
        lines[N][0] = c;
        for (i=1;i<16;i++) {
            scanf("%c", &lines[N][i]);
        }
        N++;
        scanf("%c", &c);
    }

    for (i = 0; i < 8; i++) {
        for (j = 0; j < 16; j++) {
            registers[i][j] = '0';
        }
    }

    // 

    return 0;
}
Topic archived. No new replies allowed.