Compare commits

...

2 commits

Author SHA1 Message Date
DataHoarder 93a5ae1c13 Implemented INIT op
All checks were successful
continuous-integration/drone/push Build is passing
2021-08-05 16:29:29 +02:00
DataHoarder 30d8190bcb Update CI to Debian bullseye 2021-08-05 16:01:18 +02:00
4 changed files with 24 additions and 9 deletions

View file

@ -35,8 +35,9 @@ local XbpsPipeline(image, version, arch, extra="") = Pipeline(image, version, ar
AptPipeline("ubuntu", "20.04", "amd64", "g++"),
AptPipeline("ubuntu", "20.04", "arm64", "g++"),
AptPipeline("debian", "bullseye", "amd64", "g++"),
AptPipeline("debian", "bullseye", "arm64", "g++"),
AptPipeline("debian", "buster", "amd64", "g++"),
AptPipeline("debian", "buster", "arm64", "g++"),
YumPipeline("fedora", "latest", "amd64", "g++"),

View file

@ -58,6 +58,14 @@ std::vector<uint8_t> Instruction::Init::toBytes() const {
std::unique_ptr<Instruction::Instruction>
Instruction::Init::fromTokens(const Instruction::Instruction::parseOperatorResult &op,
const std::vector<Token> &tokens) {
//TODO
return nullptr;
return std::make_unique<Init>(
AddressWithOffset{tokens.at(0).getNumericValue(), op.offset1}, 1, tokens.at(1).getNumericValue(), tokens.size() > 2 ? tokens.at(2).getNumericValue() : 0, tokens.size() > 3 ? tokens.at(3).getNumericValue() : 0);
}
std::unique_ptr<Instruction::Instruction>
Instruction::Init::fromDirectTokens(const Instruction::Instruction::parseOperatorResult &op,
const std::vector<Token> &tokens) {
return std::make_unique<Init>(
AddressWithOffset{tokens.at(0).getNumericValue(), op.offset1}, 0, tokens.at(1).getNumericValue(), tokens.size() > 2 ? tokens.at(2).getNumericValue() : 0, tokens.size() > 3 ? tokens.at(3).getNumericValue() : 0);
}

View file

@ -54,11 +54,14 @@ namespace Instruction {
static std::unique_ptr<Instruction>
fromTokens(const Instruction::parseOperatorResult &op, const std::vector<Token> &tokens);
static std::unique_ptr<Instruction>
fromDirectTokens(const Instruction::parseOperatorResult &op, const std::vector<Token> &tokens);
AddressWithOffset address;
uint8_t increment;
uint32_t count;
uint32_t data;
uint32_t data_add;
AddressWithOffset address{};
uint8_t increment{};
uint32_t count{};
uint32_t data{};
uint32_t data_add{};
};
}

View file

@ -82,11 +82,14 @@ namespace Instruction {
addOperator("JUMP", 1, Jump::fromTokens);
addOperator("RETURN", 1, Return::fromTokens);
//TODO INIT
addOperator("WRITE", 2, Write::fromTokens);
addOperator("COPY", 2, Copy::fromTokens);
// INIT <R> <count> [data] [data_add]
addOperator("INIT", 2, Init::fromTokens);
addOperator("INIT_DIRECT", 2, Init::fromDirectTokens);
addOperator("LOAD", 2, Load::fromTokens);
addOperator("LOAD_DIRECT", 2, Load::fromDirectTokens);