Struct Assembler

Source
pub struct Assembler { /* private fields */ }

Implementations§

Source§

impl Assembler

Source

pub fn new() -> Assembler

Source

pub fn bytes(&self) -> Vec<u8>

Source

pub fn mw(&mut self, dest: Register, src: RegisterOrImm)

Moves a register or 8-bit immediate value from src into a register dest.

§Panics

Panics if the src operand is not RegisterOrImm::Reg() or RegisterOrImm:Imm8().

Source

pub fn lw(&mut self, dest: Register, src: Option<u16>)

Loads a 8-bit value from memory into a register dest. If src is Some(...), the value passed in src is used as the source address. If src is None, the value in the HL register is used as the source address.

Source

pub fn sw(&mut self, dest: Option<u16>, src: Register)

Stores an 8-bit value from a register src into memory. If dest is Some(...), the value passed in dest is used as the destination address. If dest is None, the value in the HL register is used as the destination address.

Source

pub fn push(&mut self, src: RegisterOrImm)

Pushes a register or 8-bit immediate value onto the stack.

§Panics

Panics if the src operand is not RegisterOrImm::Reg() or RegisterOrImm:Imm8().

Source

pub fn pop(&mut self, dest: Register)

Pops a value from the stack and loads it into a register dest.

Source

pub fn lda(&mut self, addr: u16)

Loads a 16-bit value from memory into the HL register.

Source

pub fn jnz(&mut self, src: RegisterOrImm)

Jumps to the address specified by the HL register if the immediate value src or the value in the register src is not zero.

§Panics

Panics if the src operand is not RegisterOrImm::Reg() or RegisterOrImm:Imm8().

Source

pub fn inb(&mut self, dest: Register, src: RegisterOrImm)

Reads a byte from the port specified by src into a register dest.

§Panics

Panics if the src operand is not RegisterOrImm::Reg() or RegisterOrImm:Imm8().

Source

pub fn outb(&mut self, dest: RegisterOrImm, src: Register)

Writes a byte from a register src to the port specified by dest.

§Panics

Panics if the dest operand is not RegisterOrImm::Reg() or RegisterOrImm:Imm8().

Source

pub fn add(&mut self, dest: Register, src: RegisterOrImm)

Adds a register or 8-bit immediate value src and the value in a register dest. The result is stored in the register dest.

§Panics

Panics if the src operand is not RegisterOrImm::Reg() or RegisterOrImm:Imm8().

Source

pub fn adc(&mut self, dest: Register, src: RegisterOrImm)

Adds with carry a register or 8-bit immediate value src and the value in a register dest. The result is stored in the register dest.

§Panics

Panics if the src operand is not RegisterOrImm::Reg() or RegisterOrImm:Imm8().

Source

pub fn and(&mut self, dest: Register, src: RegisterOrImm)

Performs a bitwise AND operating on a register or 8-bit immediate value src and the value in a register dest. The result is stored in the register dest.

§Panics

Panics if the src operand is not RegisterOrImm::Reg() or RegisterOrImm:Imm8().

Source

pub fn or(&mut self, dest: Register, src: RegisterOrImm)

Performs a bitwise OR operating on a register or 8-bit immediate value src and the value in a register dest. The result is stored in the register dest.

§Panics

Panics if the src operand is not RegisterOrImm::Reg() or RegisterOrImm:Imm8().

Source

pub fn nor(&mut self, dest: Register, src: RegisterOrImm)

Performs a bitwise NOR operating on a register or 8-bit immediate value src and the value in a register dest. The result is stored in the register dest.

§Panics

Panics if the src operand is not RegisterOrImm::Reg() or RegisterOrImm:Imm8().

Source

pub fn cmp(&mut self, left: Register, right: RegisterOrImm)

Compares a register or 8-bit immediate value src and the value in a register dest. Sets the flags register accordingly.

§Panics

Panics if the src operand is not RegisterOrImm::Reg() or RegisterOrImm:Imm8().

Source

pub fn sbb(&mut self, dest: Register, src: RegisterOrImm)

Subtracts a register or 8-bit immediate value src from the value in a register dest. The result is stored in the register dest.

§Panics

Panics if the src operand is not RegisterOrImm::Reg() or RegisterOrImm:Imm8().

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.