registry bound check

This commit is contained in:
2024-10-24 18:11:19 +02:00
parent 7c72155fea
commit 777adffdea

View File

@@ -106,7 +106,10 @@ std::uint32_t Assembleur::ParseIO(Instruction a_Instruction, std::uint32_t a_R1,
static std::uint32_t ParseRegistry(const std::string& a_Str) {
if (a_Str.at(0) != 'R')
throw std::runtime_error("Registry " + a_Str + " not found !");
return std::stoi(a_Str.substr(1));
std::uint32_t registry = std::stoi(a_Str.substr(1));
if (registry > 7)
throw std::runtime_error("You can only have up to 8 registries !");
return registry;
}
static bool IsConstant(const std::string& a_Str) {