/**
   * Retrieves program counter
   *
   * @param program assembly language program
   * @return (int) program counter
   */
  public void addInstructions() {

    for (int i = 0; i < simulator.getCodeSegmentFile().size(); i++) {
      boolean end = false;
      String instruction = simulator.getCodeSegmentFile().get(i).toString();

      String label = "";
      String endlabel = "";
      Set<String> table = SymbolTable.getInstance().getSymbolTable().keySet();

      for (String key : table) {
        int location = SymbolTable.getInstance().getLocation(key);
        String type = SymbolTable.getInstance().getType(key);
        if (location == i && type.equals("code")) {
          label = " " + key;
        }
        if (location > (simulator.getCodeSegmentFile().size() - 1)
            && i == simulator.getCodeSegmentFile().size() - 1) {
          endlabel = key;
          end = true;
        }
      }
      String[] temp = {
        (simulator.getCodeSegmentFile().get(i).getSize() * (i + 1)) + " " + label, instruction
      };
      model.addRow(temp);
      if (end) {
        String[] endTemp = {
          (simulator.getCodeSegmentFile().get(i).getSize() * (i + 1) + 2) + " " + endlabel, " "
        };
        model.addRow(endTemp);
      }
    }
  }