p101_is 1.0.0

Represent Olivetti Programma 101 programs
Documentation
use std::fmt;

/// Identifies the memory location as jump target 
/// for the relative jump instruction.
#[allow(non_camel_case_types)]
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
pub enum JumpDestination {
    // Destinations for jumps
    AV,
    AW,
    AY,
    AZ,
    BV,
    BW,
    BY,
    BZ,
    EV,
    EW,
    EY,
    EZ,
    FV,
    FW,
    FY,
    FZ,
    // Destinations for conditinoal jumps
    aV,
    aW,
    aY,
    aZ,
    bV,
    bW,
    bY,
    bZ,
    eV,
    eW,
    eY,
    eZ,
    fV,
    fW,
    fY,
    fZ,
}

impl fmt::Display  for JumpDestination {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> Result<(), fmt::Error> {
        let text = match self {
            JumpDestination::aV => "aV",
            JumpDestination::aW => "aW",
            JumpDestination::aY => "aY",
            JumpDestination::aZ => "aZ",
            JumpDestination::AV => "AV",
            JumpDestination::AW => "AW",
            JumpDestination::AY => "AY",
            JumpDestination::AZ => "AZ",
            JumpDestination::BV => "BV",
            JumpDestination::bV => "bV",
            JumpDestination::BW => "BW",
            JumpDestination::bW => "bW",
            JumpDestination::BY => "BY",
            JumpDestination::bY => "bY",
            JumpDestination::BZ => "BZ",
            JumpDestination::bZ => "bZ",
            JumpDestination::EV => "EV",
            JumpDestination::eV => "eV",
            JumpDestination::EW => "EW",
            JumpDestination::eW => "eW",
            JumpDestination::EY => "EY",
            JumpDestination::eY => "eY",
            JumpDestination::EZ => "EZ",
            JumpDestination::eZ => "eZ",
            JumpDestination::FV => "FV",
            JumpDestination::fV => "fV",
            JumpDestination::FW => "FW",
            JumpDestination::fW => "fW",
            JumpDestination::FY => "FY",
            JumpDestination::fY => "fY",
            JumpDestination::FZ => "FZ",
            JumpDestination::fZ => "fZ"
        };

        write!(f, "{}", text)
    }
}