added M records

This commit is contained in:
zanostro 2025-12-21 17:17:52 +01:00
parent e0ce2fb3d0
commit a711223abf
11 changed files with 297 additions and 20 deletions

View file

@ -36,6 +36,12 @@ private:
int _programLength = 0;
std::string _programName;
int _baseRegister = -1; // -1 means not set
struct ModificationRecord {
int address;
int halfBytes;
};
mutable std::vector<ModificationRecord> _modificationRecords;
// Pass 1: build symbol table and assign addresses
void firstPass();

View file

@ -27,6 +27,7 @@ public:
enum class RecordType {
HEADER,
TEXT,
MODIFICATION,
END,
UNKNOWN
};
@ -40,6 +41,11 @@ public:
int start_address;
std::vector<uint8_t> data;
};
struct ModificationRecord {
int address; // Address to be modified
int length; // Length in nibbles
bool add; // true for +, false for -
};
struct EndRecord {
int execution_start_address;
};
@ -54,10 +60,13 @@ private :
shared_ptr<Machine> _machine;
string _filename;
shared_ptr<FileReader> _file_reader;
int _relocation_address;
HeaderMetadata readHeader();
TextRecord readTextRecord();
ModificationRecord readModificationRecord();
EndRecord readEndRecord();
bool load_into_memory(int start_address, const std::vector<uint8_t>& data);
void applyModification(const ModificationRecord& mod);
};

View file

@ -6,6 +6,7 @@
#include <unordered_map>
#include <string_view>
#include <optional>
#include <cstdint>
// ==============================
// Opcode definitions (SIC/XE)