Enum Instruction

Source
pub enum Instruction {
Show 25 variants CLS, RET, JMP(JmpData), CALL(CallData), SKIP(SkipData), MOV(MovData), ADD(AddData), OR(OrData), AND(AndData), XOR(XorData), SUB(SubData), SHR(ShrData), SUBN(SubnData), SHL(ShlData), JPC(JpcData), RAND(RandData), DRAW(DrawData), GDL(GdlData), KEY(KeyData), SDL(SdlData), SND(SndData), SCH(SchData), BCD(BcdData), RDP(RdpData), RLD(RldData),
}
Expand description

A Chip-8 instruction. All instructions that execute a calculation store the result in their first argument.

Variants§

§

CLS

Clears the screen

§

RET

Returns from a subroutine

§

JMP(JmpData)

Unconditionally jumps to an address

§

CALL(CallData)

Calls a subroutine

§

SKIP(SkipData)

Skips the next instruction if a SkipType condition is met

§

MOV(MovData)

Assigns values to registers or moves one register’s value into another

§

ADD(AddData)

Adds two registers, or a register and a value. When both operands are registers, VF is set to 1 when the result exceeds the size of the destination register, and 0 otherwise.

§

OR(OrData)

Bitwise ORs two registers

§

AND(AndData)

Bitwise ANDs two registers

§

XOR(XorData)

Bitwise XORs two registers

§

SUB(SubData)

Subtracts one register from another, with the second register subtracted from the first. VF is set to 0 when there’s a borrow, and 1 if there isn’t.

§

SHR(ShrData)

Stores the least significant bit of a register in VF and shifts that register to the right 1 bit

§

SUBN(SubnData)

Subtracts one register from another, with the first register subtracted from the second. VF is set to 0 when there’s a borrow, and 1 when there isn’t.

§

SHL(ShlData)

Stores the most significant bit of a register in VF and shifts that register to the left one bit

§

JPC(JpcData)

Unconditionally jumps to an address defined by a constant plus the V0 register

§

RAND(RandData)

Stores a random 8-bit integer bitwise ANDed with a given constant in a register

§

DRAW(DrawData)

Draws a sprite at coordinates defined by two registers with a width of 8 pixels and a given height. The sprite is read as bits from memory starting at address I. VF is set to 1 if any pixels are flipped from on to off, and to 0 if not.

§

GDL(GdlData)

Sets a register to the current value of the delay timer

§

KEY(KeyData)

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

§

SDL(SdlData)

Sets the delay timer to the value of a register

§

SND(SndData)

Sets the sound timer to the value of a register

§

SCH(SchData)

Puts the memory location of the hex character corresponding to the value of a register into I

§

BCD(BcdData)

Stores the binary-coded decimal representation of a register in memory location I, with the hundreds digit in the lowest byte.

§

RDP(RdpData)

Dumps the contents of all registers up to and including a specified register into memory starting at location I

§

RLD(RldData)

Loads all registers up to and including a specified register from data starting at location I

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.