[][src]Enum lasm::asm::Register

pub enum Register {
    StackPointer,
    Accumulator,
    Named {
        name: String,
        size: usize,
        addr: usize,
    },
}

The Register enum represents a register in an assembly program (obviously)

Variants

StackPointer

The register that points to where the next item on the stack will be stored to

Accumulator

The register that stores temporary values in several instructions

Named

A register defined by the user. Each register's address and size is known statically.

Fields of Named

name: String

the name of the user defined register

size: usize

the number of cells that the register occupies

addr: usize

the address of the register

Methods

impl Register[src]

pub fn named(name: impl Display) -> Option<Self>[src]

Get a user defined register by its name. The register MUST be previously defined.

pub fn define(name: impl Display, size: usize) -> Self[src]

Define a Register with a given name and size. This will create a Register in the NAMED_REGISTERS map with the value of REGISTER_POINTER as the Register's address.

pub fn get_addr(&self) -> usize[src]

Get the address where this register is stored. This is used in many instructions, most notably the refer instruction.

pub fn get_size(&self) -> usize[src]

Get the number of cells this register occupies. Both the StackPointer and the Accumulator are one cell each

Trait Implementations

impl Clone for Register[src]

impl Debug for Register[src]

impl PartialEq<Register> for Register[src]

impl PartialOrd<Register> for Register[src]

impl StructuralPartialEq for Register[src]

Auto Trait Implementations

impl RefUnwindSafe for Register

impl Send for Register

impl Sync for Register

impl Unpin for Register

impl UnwindSafe for Register

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 = !

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.