added loading
This commit is contained in:
parent
598865d216
commit
7b79c35f63
8 changed files with 84 additions and 14 deletions
|
|
@ -1,6 +1,7 @@
|
|||
#ifndef CONSTANTS_H
|
||||
#define CONSTANTS_H
|
||||
|
||||
#include <string>
|
||||
// ==============================
|
||||
// SIC/XE Architecture Constants
|
||||
// ==============================
|
||||
|
|
@ -39,5 +40,13 @@ constexpr int BIT_E_MASK = 0x10; // mask for e bit in F4 and F3 instructions
|
|||
constexpr bool USE_EXTENDED_MODE = true;
|
||||
constexpr int VECTOR_REG_SIZE = 4;
|
||||
|
||||
/* if structure is
|
||||
/target/
|
||||
|-> bin/simulator_exec
|
||||
|-> res/
|
||||
*/
|
||||
// When running from project root (./target/bin/simulator_exec), resources are in ./target/res/
|
||||
constexpr char PATH_RESOURCES[] = "./target/res/";
|
||||
constexpr bool FILE_CONTAINS_WHITE_SPACES = true;
|
||||
|
||||
#endif // CONSTANTS_H
|
||||
|
|
@ -5,6 +5,7 @@
|
|||
#include <string>
|
||||
#include <vector>
|
||||
#include "file_reader.h"
|
||||
#include <stdexcept>
|
||||
|
||||
class Machine;
|
||||
|
||||
|
|
@ -16,6 +17,9 @@ class Loader {
|
|||
public:
|
||||
Loader( shared_ptr<Machine> machine, string filename) : _machine(machine), _filename(filename) {
|
||||
_file_reader = std::make_shared<FileReader>(filename, std::ios::in);
|
||||
if (!_file_reader->good()) {
|
||||
throw std::runtime_error("Loader: failed to open file: " + filename);
|
||||
}
|
||||
}
|
||||
~Loader();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue