Enum feo3boy_opcodes::opcode::Opcode
source · pub enum Opcode {
Show 27 variants
Nop,
Stop,
JumpRelative(ConditionCode),
Inc8(Operand8),
Dec8(Operand8),
Load8 {
dest: Operand8,
source: Operand8,
},
Inc16(Operand16),
Dec16(Operand16),
Load16 {
dest: Operand16,
source: Operand16,
},
Add16(Operand16),
Halt,
AluOp {
op: AluOp,
operand: Operand8,
},
AluUnary(AluUnaryOp),
Call(ConditionCode),
Jump(ConditionCode),
Ret(ConditionCode),
Push(Operand16),
Pop(Operand16),
PrefixCB,
DisableInterrupts,
EnableInterrupts,
RetInterrupt,
OffsetSp,
AddressOfOffsetSp,
JumpHL,
Reset(u8),
MissingInstruction(u8),
}
Expand description
Parsed Opcode, not including any arguments that may be loaded from immediates, nor any follow-up ops if the operation is a prefixed op.
Variants§
Nop
No operation.
Stop
Stop – not sure what this does or how this differs from Halt.
JumpRelative(ConditionCode)
Relative jump. Load a signed immediate for the jump destination, then check the condition, then jump if the condition is met.
Inc8(Operand8)
Increment the given 8 bit operand.
Dec8(Operand8)
Decrement the given 8 bit operand.
Load8
Load a value from on 8 bit operand to another.
Inc16(Operand16)
Increment the given 16 bit operand.
Dec16(Operand16)
Decrement the given 16 bit operand.
Load16
Load a 16 bit value from one operand to another.
Add16(Operand16)
Add the given 16 bit operand to HL.
Halt
Halt instruction. Pauses but still accepts interrupts.
AluOp
Run the given operation on the ALU. The source is given by the operand, the destination is
always A
, the accumulator register.
AluUnary(AluUnaryOp)
Run the given unary operation on the ALU. These ops all affect only the accumulator and flags, or just the flags.
Call(ConditionCode)
Conditional call. Load unsigned 16 bit immediate, check condtion, then if condition matches push current PC and jump to the loaded address.
Jump(ConditionCode)
Conditional absolute jump. Load unsigned 16 bit immediate, check condition, then if condition matches, jump to the loaded address.
Ret(ConditionCode)
Conditional return. Check the condition, then pop the stack and jump to the address.
Push(Operand16)
Push a 16 bit register pair to the stack, moving the stack pointer.
Pop(Operand16)
Pop a 16 bit register pair from the stack, moving the stack pointer.
PrefixCB
Loads and executes a prefixed instruction code.
DisableInterrupts
Disable interrupt handling.
EnableInterrupts
Enable Interrupt handling.
RetInterrupt
Interrupt return, similar to unconditional return but also enables interrupts.
OffsetSp
Load an 8 bit signed immediate and add it to the stack pointer.
AddressOfOffsetSp
Load an 8 bit signed immediate and add it to the stack pointer, storing the result in HL.
JumpHL
Jump to the address stored in HL.
Reset(u8)
Reset with numeric arg.
MissingInstruction(u8)
The instruction decoded to an opcode the processor doesn’t actually have. This functions equivalently to Nop (I think????). Contained value is the raw opcode.
Implementations§
Trait Implementations§
source§impl Ord for Opcode
impl Ord for Opcode
source§impl PartialEq<Opcode> for Opcode
impl PartialEq<Opcode> for Opcode
source§impl PartialOrd<Opcode> for Opcode
impl PartialOrd<Opcode> for Opcode
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read more