[][src]Enum chip_8::instructions::Instruction

pub enum Instruction {
    Sys(Addr),
    Clear,
    Return,
    Jump(Addr),
    Call(Addr),
    SkipEqualOperand(VxByte),
    SkipNotEqualOperand(VxByte),
    SkipEqual(VxVy),
    LoadOperand(VxByte),
    AddOperand(VxByte),
    Load(VxVy),
    Or(VxVy),
    And(VxVy),
    XOr(VxVy),
    Add(VxVy),
    Sub(VxVy),
    ShiftRight(VxVy),
    SubNegated(VxVy),
    ShiftLeft(VxVy),
    SkipNotEqual(VxVy),
    LoadI(Addr),
    LongJump(Addr),
    Random(VxByte),
    Draw(VxVyNibble),
    SkipKeyPressed(Vx),
    SkipKeyNotPressed(Vx),
    LoadRegisterDelayTimer(Vx),
    LoadKey(Vx),
    LoadDelayTimerRegister(Vx),
    LoadSoundTimerRegister(Vx),
    AddI(Vx),
    LoadSprite(Vx),
    LoadBinaryCodedDecimal(Vx),
    LoadMemoryRegisters(Vx),
    LoadRegistersMemory(Vx),
}

Byte code instruction

Variants

Sys(Addr)

Jumps to machine routine at Addr

0nnn - SYS addr

Clear

Clears the display

00E0 - CLS

Return

Returns from a subroutine

00EE - RET

Jump(Addr)

Jumps to Addr

1nnn - JP addr

Call(Addr)

Calls subroutine at Addr

2nnn - CALL addr

SkipEqualOperand(VxByte)

Skips next instruction if Vx equals byte

3xkk - SE Vx, byte

SkipNotEqualOperand(VxByte)

Skips next instruction if Vx is not equal to byte

4xkk - SNE Vx, byte

SkipEqual(VxVy)

Skips next instruction if Vy is equal to Vy

5xy0 - SE Vx, Vy

LoadOperand(VxByte)

Loads byte into Vx

6xkk - LD Vx, byte

AddOperand(VxByte)

Adds byte to Vx, then stores it in Vx

7xkk - ADD Vx, byte

Load(VxVy)

Loads Vy into Vx

8xy0 - LD Vx, Vy

Or(VxVy)

Sets Vx to Vx OR Vy

8xy1 - OR Vx, Vy

And(VxVy)

Sets Vx to Vx AND Vy

8xy2 - AND Vx, Vy

XOr(VxVy)

Sets Vx to Vx XOR Vy

8xy3 - XOR Vx, Vy

Add(VxVy)

Sets Vx to Vx + Vy, VF to carry

8xy4 - ADD Vx, Vy

Sub(VxVy)

Sets Vx to Vx - Vy, VF to not borrow

8xy5 - SUB Vx, Vy

ShiftRight(VxVy)

Sets Vx to Vy SHR 1

8xy6 - SHR Vx {, Vy}

SubNegated(VxVy)

Sets Vx to Vy - Vx, VF to not borrow

8xy7 - SUBN Vx, Vy

ShiftLeft(VxVy)

Sets Vx to Vy SHL 1

8xyE - SHL Vx {, Vy}

SkipNotEqual(VxVy)

Skips next instruction if Vx is not equal to Vy

9xy0 - SNE Vx, Vy

LoadI(Addr)

Loads Addr into register I

Annn - LD I, addr

LongJump(Addr)

Jumps to Addr + V0

Bnnn - JP V0, addr

Random(VxByte)

Sets Vx to random number AND kk

Cxkk - RND Vx, byte

Draw(VxVyNibble)

Read n bytes of memory from address I, draw it at Vx and Vy screen coordinates and set VF for erased pixels

Dxyn - DRW Vx, Vy, nibble

SkipKeyPressed(Vx)

Skip next instruction if key Vx is pressed

Ex9E - SKP Vx

SkipKeyNotPressed(Vx)

Skip next instruction if key Vx is not pressed

ExA1 - SKNP Vx

LoadRegisterDelayTimer(Vx)

Set Vx to delay timer value

Fx07 - LD Vx, DT

LoadKey(Vx)

Wait for key press and store it in Vx

Fx0A - LD Vx, K

LoadDelayTimerRegister(Vx)

Set delay timer to Vx

Fx15 - LD DT, Vx

LoadSoundTimerRegister(Vx)

Set sound timer to Vx

Fx18 - LD ST, Vx

AddI(Vx)

Add Vx to I

Fx1E - ADD I, Vx

LoadSprite(Vx)

Set I to the address of the sprite Vx

Fx29 - LD F, Vx

LoadBinaryCodedDecimal(Vx)

Store binary-coded decimal (BCD) at I, I+1 and I+2

Fx33 - LD B, Vx

LoadMemoryRegisters(Vx)

Store registers V0..Vx in memory at I

Fx55 - LD [I], Vx

LoadRegistersMemory(Vx)

Read registers V0..Vx from memory at I

Fx65 - LD Vx, [I]

Implementations

impl Instruction[src]

pub fn decode(bits: u16) -> Result<Self>[src]

Decodes raw bits into a valid Instruction

Errors

Will return Chip8Error::UnknownInstruction if given bits don't match any known instruction.

Trait Implementations

impl Clone for Instruction[src]

impl Copy for Instruction[src]

impl Debug for Instruction[src]

impl Eq for Instruction[src]

impl PartialEq<Instruction> for Instruction[src]

impl StructuralEq for Instruction[src]

impl StructuralPartialEq for Instruction[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,