momiji
m68k emulator infrastructure
About Source codeTable of contents
Decoder
Component dedicated to decoding an instruction (located at a specific offset) from an executable program.
Notes
-
If the decoder finds an ill-formed binary (which, in turn, means that an ill-formed instruction was found) then an illegal instruction will be generated. Upon invoking such instruction a trap will be signaled to the running
momiji::System
. -
No information about what instruction is being executed is provided, other than the decoded string.
-
The string of the instruction is reconstructed on the fly by the decoder.
Basic usage example
momiji::ExecutableMemory binary = momiji::compile(/* ... */);
// Decode the instruction at offset zero
momiji::DecodedInstruction instr0 = momiji::decode(binary, 0);
// Print the string of the instruction
std::cout << instr0.string << '\n';
// Create an emulated system where the instruction will be executed
momiji::System system;
// Execute the instruction
instr0.exec(system, instr0.data);
// system is now modified
Classes
momiji::DecodedInstruction |
A class representing a decoded instruction generated from the decoder. |
momiji::InstructionData |
A compact class representing the data inside an instruction. This class is filled in by the decoder and it’s used in the implementation of the instruction to retrieve the correct parameters. |
Free functions
momiji::decode |
Decodes one instruction at a specific offset inside an executable memory. |
Typedefs
Type | Definition | Notes |
---|---|---|
InstructionString | std::string |
Describes the original “string” form of an instruction. |
DecodedInstructionFn |
|
A function pointer to the implementation of a specific instruction. |