i8051_disassembler/render/
mod.rs1use crate::{address::AddressValue, db::DataType};
2
3pub mod data;
4pub mod sdas;
5
6#[derive(Debug, Clone)]
7pub enum Line {
8 Org {
9 addr: AddressValue,
10 },
11 Blank,
12 Comment {
13 addr: AddressValue,
14 text: String,
15 },
16 Label {
17 addr: AddressValue,
18 name: String,
19 },
20 Instruction {
21 addr: AddressValue,
22 direct: Option<u8>, text: String,
24 bytes: Vec<u8>,
25 },
26 Data {
27 addr: AddressValue,
28 data_type: DataType,
29 bytes: Vec<u8>,
30 },
31 Raw {
32 addr: AddressValue,
33 bytes: Vec<u8>,
34 },
35 Function {
36 addr: AddressValue,
37 name: String,
38 signature: Option<String>,
39 length: AddressValue,
40 noreturn: bool,
41 },
42}
43
44impl Line {
45 pub fn addr(&self) -> AddressValue {
46 match self {
47 Self::Org { addr, .. }
48 | Self::Comment { addr, .. }
49 | Self::Label { addr, .. }
50 | Self::Function { addr, .. }
51 | Self::Instruction { addr, .. }
52 | Self::Data { addr, .. }
53 | Self::Raw { addr, .. } => *addr,
54 Self::Blank => 0,
55 }
56 }
57}