Enum chip8_vm::instructions::Instruction [] [src]

pub enum Instruction {
    Sys(Addr),
    Clear,
    Return,
    Jump(Addr),
    Call(Addr),
    SkipEqualK(VxByte),
    SkipNotEqualK(VxByte),
    SkipEqual(VxVy),
    SetK(VxByte),
    AddK(VxByte),
    Set(VxVy),
    Or(VxVy),
    And(VxVy),
    XOr(VxVy),
    Add(VxVy),
    Sub(VxVy),
    ShiftRight(VxVy),
    SubInv(VxVy),
    ShiftLeft(VxVy),
    SkipNotEqual(VxVy),
    LoadI(Addr),
    LongJump(Addr),
    Rand(VxByte),
    Draw(VxVyNibble),
    SkipPressed(Vx),
    SkipNotPressed(Vx),
    GetTimer(Vx),
    WaitKey(Vx),
    SetTimer(Vx),
    SetSoundTimer(Vx),
    AddToI(Vx),
    LoadHexGlyph(Vx),
    StoreBCD(Vx),
    StoreRegisters(Vx),
    LoadRegisters(Vx),
    Unknown,
}

High-level instruction

A valid instruction that can be executed as-is.

Variants

Jumps to machine subroutine at Addr.

Note that this is intentionally not implemented in the Vm.

Clears the screen.

Sets all pixels to the unlit state.

Returns from a subroutine

Jumps to Addr

Calls subroutine at Addr

Skips the next instructions if Vx equals Byte

Skips the next instruction if Vx does not equal Byte

Skips the next instruction if Vx and Vy are equal

Sets Vy to Byte

Adds Byte to Vx, then stores the result in Vx

Stores Vy in Vx

Performs a bitwise OR (|) of Vx and Vy, then stores the result in Vx

Performs a bitwise AND (&) of Vx and Vy, then stores the result in Vx

Performs a bitwise XOR (^) of Vx and Vy, then stores the result in Vx

Adds Vx and Vy, then stores the result in in Vx.

VF is set to 1 on overflow, 0 otherwise.

Subtracts Vy from Vx, then stores the result in Vx.

VF is set to 1 if Vx is larger than Vy prior subtraction, 0 otherwise.

Shifts Vy right by one bit, then stores the result in Vx.

Stores the least-significant bit prior shift of Vy in VF.

Subtracts Vx from Vy, then stores the result in Vx.

VF is set to 1 if Vx is larger than Vy prior subtraction, 0 otherwise.

Note that this is the same as Sub with inverted register operands.

Shifts Vy left by one bit, then stores the result in Vx.

Stores the most-significant bit prior shift of Vy in VF.

Skips the next instruction if Vx and Vy are not equal

Sets the I register to Addr

Jumps to V0 + Addr

Sets Vx to a random byte ANDed with Byte

Draws the sprite with Nibble bytes of data from the I register at position (Vx, Vy).

Sets VF to 1 if any pixels are set to unlit state, 0 otherwise.

Note that sprites wrap around onto the opposite side of the screen.

Skips the next instruction if key Vx is pressed

Skips the next instruction if key Vx is not pressed

Stores the value of the delay timer in Vx

Stops execution until a key is pressed, then stores that key in Vx

Sets the delay timer to Vx

Sets the sound timer to Vx

Adds Vx and the I register, then stores the result in I

Stores the address of the hexadecimal digit Vx in the I register

Stores the binary-coded decimal representation of Vx at address I, I + 1 and I + 2

Stores the registers V0 to Vx inclusive at address I.

Register I is set to I + Vx + 1 afterwards.

Reads the registers V0 to Vx inclusive from address I.

Register I is set to I + Vx + 1 afterwards.

Placeholder for an unknown or illegal instruction.

Note that this is not a real CHIP-8 instruction.

Methods

impl Instruction
[src]

Creates a new instruction from raw bits, or Instruction::Unknown if no valid match could be found

Trait Implementations

impl Clone for Instruction
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl Copy for Instruction
[src]

impl Debug for Instruction
[src]

Formats the value using the given formatter.