33 #define MAX_PROG_LEN 99 // The maximum length (in lines) a program can have
34 #define MAX_LINE_LEN 80 // The maximum length of a program line (in characters)
35 #define MAX_OPCODE 10 // The maximum number of opcodes that are supported
36 #define MAX_REGISTER 4 // The maximum number of registers (minus INSP)
37 #define OPCODE_LENGTH 3 // The maximum length of an opcode
38 #define ARG_LENGTH 4 // The maximum length of an arg
39 #define OPCODE 0 // Used for parsing instruction segments
44 int opcodeNOP(
char* opcode,
char* arg1,
char* arg2);
45 int opcodeSET(
char* opcode,
char* arg1,
char* arg2);
46 int opcodeAND(
char* opcode,
char* arg1,
char* arg2);
47 int opcodeOR(
char* opcode,
char* arg1,
char* arg2);
48 int opcodeADD(
char* opcode,
char* arg1,
char* arg2);
49 int opcodeSUB(
char* opcode,
char* arg1,
char* arg2);
50 int opcodeSHL(
char* opcode,
char* arg1,
char* arg2);
51 int opcodeSHR(
char* opcode,
char* arg1,
char* arg2);
52 int opcodeJMP(
char* opcode,
char* arg1,
char* arg2);
53 int opcodePRT(
char* opcode,
char* arg1,
char* arg2);
59 bool isValid(
char* opcode,
char* arg1,
char* arg2);
int opcodeOR(char *opcode, char *arg1, char *arg2)
Definition: emulator.c:172
int loadProgram()
Definition: emulator.c:466
int opcodeSET(char *opcode, char *arg1, char *arg2)
Definition: emulator.c:124
int opcodeSHR(char *opcode, char *arg1, char *arg2)
Definition: emulator.c:268
int opcodeNOP(char *opcode, char *arg1, char *arg2)
Definition: emulator.c:107
int execInstruction(char *instruction)
Definition: emulator.c:388
int execProgram()
Definition: emulator.c:444
int opcodeSUB(char *opcode, char *arg1, char *arg2)
Definition: emulator.c:220
int opcodeADD(char *opcode, char *arg1, char *arg2)
Definition: emulator.c:196
int opcodeAND(char *opcode, char *arg1, char *arg2)
Definition: emulator.c:148
int opcodePRT(char *opcode, char *arg1, char *arg2)
Definition: emulator.c:311
int getArg2(char *arg2)
Definition: emulator.c:334
int opcodeSHL(char *opcode, char *arg1, char *arg2)
Definition: emulator.c:244
bool isValid(char *opcode, char *arg1, char *arg2)
Definition: emulator.c:352
int opcodeJMP(char *opcode, char *arg1, char *arg2)
Definition: emulator.c:291