From 5487fb66a2eba979af4e58f49c77c84795c9a38d Mon Sep 17 00:00:00 2001 From: Reid 'arrdem' McKenzie Date: Mon, 2 Jan 2023 23:12:06 -0700 Subject: [PATCH] Add jump-immediate extension to the ISA --- src/isa.rs | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/isa.rs b/src/isa.rs index 3576e5f..a24c4ff 100644 --- a/src/isa.rs +++ b/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), } }