pub struct Mipsasm<'a> { /* private fields */ }
Expand description

An instance of the assembler/disassembler

Implementations

Create a new Mipsasm instance.

Sets the base address to 0 and the debug flag to false.

Set the base address for the assembler.

Examples
use mipsasm::Mipsasm;

let mut mipsasm = Mipsasm::new();
mipsasm.base(0x8000_0000);

Provides the assembler with a set of symbols.

Examples
use mipsasm::Mipsasm;
use std::collections::HashMap;

let mut mipsasm = Mipsasm::new();
mipsasm.symbols(HashMap::from_iter(vec![("foo", 0x8000_0000)]));

Set the debug flag for the assembler.

When debug is set to true, the disassembler will print instructions with all extra whitespace stripped. This is used for testing and will most likely not be useful for other purposes.

Examples
use mipsasm::Mipsasm;

let mut mipsasm = Mipsasm::new();
mipsasm.debug();

Assembles a set of MIPS assembly instructions.

Examples
use mipsasm::Mipsasm;
let mut mipsasm = Mipsasm::new();
let instructions = mipsasm.assemble("
   add $t0, $t1, $t2
  addi $t0, $t1, 0x1234
");

Disassembles a set of MIPS instructions.

Examples
use mipsasm::Mipsasm;

let mut mipsasm = Mipsasm::new();
let instructions = mipsasm.disassemble(&[0x00850018]);
assert_eq!(instructions, vec!["mult       $a0, $a1"]);

Trait Implementations

Returns the “default value” for a type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.