Add jump-immediate extension to the ISA
This commit is contained in:
parent
b0260ce315
commit
5487fb66a2
1 changed files with 15 additions and 3 deletions
18
src/isa.rs
18
src/isa.rs
|
@ -4,8 +4,16 @@ pub struct Icode {}
|
|||
impl Icode {
|
||||
// Official names
|
||||
pub const BRK: u8 = 0x00u8;
|
||||
pub const LIT: u8 = 0b10000000; // AKA keep Yes really. Per spec;
|
||||
pub const LIT2: u8 = 0b10100000; // AKA keep Yes really. Per spec;
|
||||
|
||||
// LIT is BRK + flags
|
||||
pub const LIT: u8 = 0x80; // AKA keep Yes really. Per spec;
|
||||
pub const LIT2: u8 = 0xa0; // AKA keep Yes really. Per spec;
|
||||
|
||||
// Jump-immediate extensions (again BRK + flags)
|
||||
pub const JMI: u8 = 0x20; // Jump [to] immediate
|
||||
pub const JCI: u8 = 0x40; // Jump Conditional Immediate
|
||||
pub const JSI: u8 = 0x60; // Jump Storing Immediate (call)
|
||||
|
||||
pub const INC: u8 = 0x01;
|
||||
pub const POP: u8 = 0x02;
|
||||
pub const NIP: u8 = 0x03;
|
||||
|
@ -63,7 +71,7 @@ impl Icode {
|
|||
pub const fn nameof(opcode: u8) -> &'static str {
|
||||
match opcode {
|
||||
// Nonstandard icodes + extensions
|
||||
Icode::LIT | Icode::LIT2 => "LIT", // AKA keep Yes really. Per spec,
|
||||
Icode::LIT | Icode::LIT2 => "LIT", // AKA keep. Yes really. Per spec,
|
||||
Icode::NOP => "NOP",
|
||||
// Standard icodes
|
||||
Icode::BRK => "BRK",
|
||||
|
@ -98,6 +106,10 @@ impl Icode {
|
|||
Icode::ORA => "ORA",
|
||||
Icode::EOR => "EOR",
|
||||
Icode::SFT => "SFT",
|
||||
// Jump immediate extension
|
||||
Icode::JMI => "JMI",
|
||||
Icode::JCI => "JCI",
|
||||
Icode::JSI => "JSI",
|
||||
_ => Icode::nameof(opcode & 0x1F),
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue