momiji

m68k emulator infrastructure

About Source code

Table of contents

momiji::ParserOperand

Defined in header <momiji/Parser.h>

enum class ParserOperand : std::int8_t

This enum describes possible operand types. It is primarily used for LIGHTWEIGHT error checking, like if a type of operand is in a list of other operands. This is NOT meant to be used for storing operands with their information, for that you should use [momiji::Operand]({{ ‘/userapi/Parser#typedefs’ | relative_url }}).

Naming things is hard

Values

DataRegister
AddressRegister
Address
AddressPre
AddressPost
AddressOffset
AddressIndex
Immediate
AbsoluteShort
AbsoluteLong
ProgramCounterOffset
ProgramCounterIndex

Remarks

This is completely different from momiji::Operand!

When manipulating VALUES OF OPERANDS you should use that one!

Future

This is probably the worst name in the library.

When error-checking, some context is not really needed, this means that some space can be saved when storing an error: a typical class in momiji::operands::* occupies 32 to 64 bits of memory, while a ParserOperand takes just 8 bits.

An example of this is when the parser signals that an operand is invalid for a particular instruction and then returns the list of valid operands. In that case, what would be appropriate? Creating a mock ~64-bits wide momiji::Operand to convey 8-bits of information is wasteful.