rust opcodes
This commit is contained in:
parent
d65bef661e
commit
509ccc132d
|
@ -1,6 +1,6 @@
|
|||
use std::fmt;
|
||||
|
||||
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
|
||||
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash, Debug)]
|
||||
#[repr(transparent)]
|
||||
pub struct Reg(pub u16);
|
||||
|
||||
|
@ -16,11 +16,11 @@ pub struct ConstIdx(pub u16);
|
|||
|
||||
impl fmt::Display for ConstIdx {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
write!(f, "({})", self.0)
|
||||
write!(f, "K{}", self.0)
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Eq, PartialEq)]
|
||||
#[derive(Copy, Clone, Eq, PartialEq, Debug)]
|
||||
pub enum ArgV {
|
||||
R(Reg),
|
||||
K(ConstIdx),
|
||||
|
@ -35,7 +35,7 @@ impl fmt::Display for ArgV {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Eq, PartialEq)]
|
||||
#[derive(Copy, Clone, Eq, PartialEq, Debug)]
|
||||
pub enum ArgL {
|
||||
SubI(Reg, i16),
|
||||
SubR(Reg, Reg),
|
||||
|
@ -50,11 +50,11 @@ impl fmt::Display for ArgL {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Eq, PartialEq)]
|
||||
#[derive(Copy, Clone, Eq, PartialEq, Debug)]
|
||||
pub enum Ins {
|
||||
O(InsO, i32),
|
||||
V(InsV, ArgV),
|
||||
RV(InsRV, Reg, ArgV),
|
||||
O(InsO, i32),
|
||||
RL(InsRL, Reg, ArgL),
|
||||
LV(InsLV, ArgL, ArgV),
|
||||
RRK(InsRRK, Reg, Reg, ConstIdx),
|
||||
|
@ -77,40 +77,40 @@ impl fmt::Display for Ins {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Eq, PartialEq)]
|
||||
#[derive(Copy, Clone, Eq, PartialEq, Debug)]
|
||||
pub enum InsV {
|
||||
RET,
|
||||
BTR,
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Eq, PartialEq)]
|
||||
#[derive(Copy, Clone, Eq, PartialEq, Debug)]
|
||||
pub enum InsRV {
|
||||
Op(Opr),
|
||||
Br(Cmp),
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Eq, PartialEq)]
|
||||
#[derive(Copy, Clone, Eq, PartialEq, Debug)]
|
||||
pub enum InsO {
|
||||
JMP,
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Eq, PartialEq, Debug)]
|
||||
pub enum InsRL {
|
||||
Get(Opr),
|
||||
CAL(u16),
|
||||
RETCAL(u16),
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Eq, PartialEq)]
|
||||
#[derive(Copy, Clone, Eq, PartialEq, Debug)]
|
||||
pub enum InsLV {
|
||||
Set(Opr),
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Eq, PartialEq)]
|
||||
#[derive(Copy, Clone, Eq, PartialEq, Debug)]
|
||||
pub enum InsRRK {
|
||||
LOC,
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Eq, PartialEq)]
|
||||
pub enum InsO {
|
||||
JMP,
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash, Debug)]
|
||||
pub enum Opr {
|
||||
MOV,
|
||||
|
|
Loading…
Reference in New Issue