#include "int.h" #include Op_int::Op_int(AsmArgs& args) { // At this point, the registration already ensured the number and types of args AsmArgs::Immediate8 i {std::any_cast(args[0])}; if (i.value() == 0) { // INT 0 machine_code = { 0xCE }; } else if (i.value() == 1) { // INT 1 machine_code = { 0xF1 }; } else if (i.value() == 3) { // INT 3 machine_code = { 0xCC }; } else { // INT <...> machine_code = std::vector{ 0xCD, i.value() }; } } namespace { bool registered { registerOp(mangleName("int"), [](AsmArgs& args) -> std::shared_ptr{ return std::make_shared(args); }) }; }