#ifndef SPL_H
#define SPL_H
#include <fstream>

const int CAPACITY = 100;
enum InstSet{READ = 10, WRITE = 11, LOAD = 20, STORE = 21,
     ADD = 30, SUBTRACT = 31, DIVIDE = 32, MULTIPLY = 33,
     BRANCH = 40, BRANCHNEG = 41, BRANCHZERO = 42, HALT = 43};

enum Errors{NO_ERROR = 0, DIV_BY_ZERO = 10, OUT_OF_MEM = 20, FILE_ERROR = 30};

class SPL
{
  public:
    SPL();
    SPL(char inp[]);
    ~SPL();
    Errors exec();
    void errorMESSAGE(Errors errCode);
    void read(int operand);
    void write(int operand);
    int load(int operand);
    void store(int operand, int accumulator);
    int add(int accumulator, int operand);
    int subtract(int accumulator, int operand);
    int divide(int accumulator, int operand);
    int multiply(int accumulator, int operand);
    int branch(int operand);
    int branchNEG(int operand, int counter);
    int branchZERO(int operand, int counter);
  private:
    void readProgram();
    void greetingSTART();
    void greetingEND();
    int mem[CAPACITY];
    ifstream file;
    string filename[256];
};
#endif