41 lines
840 B
Python
41 lines
840 B
Python
from __future__ import annotations
|
|
|
|
from dataclasses import dataclass, field
|
|
|
|
|
|
@dataclass
|
|
class EA:
|
|
text: str
|
|
mode: str
|
|
size: str
|
|
length: int
|
|
reg: int | None = None
|
|
value: int | None = None
|
|
address: int | None = None
|
|
|
|
|
|
@dataclass
|
|
class Instruction:
|
|
address: int
|
|
raw: bytes
|
|
mnemonic: str
|
|
operands: str = ""
|
|
kind: str = "normal"
|
|
targets: list[int] = field(default_factory=list)
|
|
fallthrough: bool = True
|
|
comment: str = ""
|
|
valid: bool = True
|
|
references: list[int] = field(default_factory=list)
|
|
writes_br: bool = False
|
|
br_value: int | None = None
|
|
|
|
@property
|
|
def size(self) -> int:
|
|
return len(self.raw)
|
|
|
|
@property
|
|
def text(self) -> str:
|
|
if self.operands:
|
|
return f"{self.mnemonic} {self.operands}"
|
|
return self.mnemonic
|