finished initial interrupts implementation
This commit is contained in:
@@ -10,7 +10,9 @@ pub enum Interrupt {
|
||||
pub type Address = u32;
|
||||
|
||||
impl Interrupt {
|
||||
const fn as_u8(self) -> u8 {
|
||||
// someone tell clippy to stfu.
|
||||
#[allow(clippy::must_use_candidate)]
|
||||
pub const fn as_u8(self) -> u8 {
|
||||
match self {
|
||||
Self::Breakpoint => 0,
|
||||
Self::HardFault => 1,
|
||||
|
||||
@@ -54,12 +54,14 @@ impl Encode for Instruction {
|
||||
],
|
||||
no_args: [Nop, IntReturn, Halt],
|
||||
special: [
|
||||
Self::Interrupt(_) => todo!(),
|
||||
Self::Data(data) => data,
|
||||
Self::Interrupt(interrupt) => {
|
||||
let opcode = u32::from(self.opcode());
|
||||
(opcode << 26) | u32::from(interrupt.as_u8())
|
||||
},
|
||||
Self::Segment(segment) => {
|
||||
let opcode = u32::from(self.opcode());
|
||||
let segment = segment as u8;
|
||||
(opcode << 26) | u32::from(segment)
|
||||
(opcode << 26) | u32::from(segment as u8)
|
||||
}
|
||||
]
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user