Crate yaxpeax_lc87[][src]

Expand description

yaxpeax-lc87, a decoder for the LC87 instruction set

the LC87 instruction set is used in the LC87 series of microcontrollers, originally developed by Sanyo, whose semiconductor division was acquired by ON Semiconductor in 2011. LC87 parts are typically named LC87*, are all 8-bit controllers, and range between 10-pin 8kb-of-flash and 100-pin 256kb-of-flash sizes.

in theory there exists an LC87 Series Users's Manual but it appears to have never existed online in original Japanese, or English translation. (the existence of an English translation is suspected but unconfirmed). by coincidence, LC87 instructions are described in the public LC872H00 datasheet, describing specifically LC872H00 parts. because the instruction set is shared across the LC87 family of microcontrollers, the instruction set listing in this manual describes the instruction set of the rest of the family.

datasheet: ANDLC872H00-D.PDF.
sha256: 9cefe73a252468bbbfb81a28e59cb9444c4c49586a616c873958b39ad4fa7b35


the fastest way to decode an lc87 instruction is through InstDecoder::decode_slice():

use yaxpeax_lc87::InstDecoder;

let inst = InstDecoder::decode_slice(&[0x0a, 0x10, 0x3f]).unwrap();

assert_eq!("bp 0010h, 2, $+0x3f", inst.to_string());

opcodes and operands are available on the decoded instruction, as well as its length and operand count:

use yaxpeax_lc87::{InstDecoder, Operand};

let inst = InstDecoder::decode_slice(&[0x0a, 0x10, 0x3f]).unwrap();

assert_eq!("bp 0010h, 2, $+0x3f", inst.to_string());
assert_eq!(inst.operand_count(), 3);
assert_eq!(inst.len(), 3);
assert_eq!(inst.operand(0).unwrap(), Operand::AbsU16 { addr: 0x0010 });
assert_eq!(inst.operand(1).unwrap(), Operand::BitIndex { index: 2 });

additionally, yaxpeax-lc87 implements yaxpeax-arch traits for generic use, such as yaxpeax_arch::LengthedInstruction. yaxpeax_arch::Arch is implemented by the unit struct LC87.


yaxpeax-lc87 should support no_std usage, but this is entirely untested.


an lc87 instruction decoder.

an lc87 instruction.

a trivial struct for yaxpeax_arch::Arch to be implemented on. it’s only interesting for the associated type parameters.


an lc87 instruction’s operation.

an operand for an lc87 instruction.