gpcas_forwardcom 0.2.1

ForwardCom instruction set architecture (ISA) properties for use with the General Purpose Core Architecture Simulator (GPCAS).
Documentation
// Filename: functions.rs
// Author:	 Kai Rese
// Version:	 0.2
// Date:	 15-07-2022 (DD-MM-YYYY)
// Library:  gpcas_forwardcom
//
// Copyright (c) 2022 Kai Rese
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this program. If not, see
// <https://www.gnu.org/licenses/>.

//! Instruction functions that are executed by the emulator.

mod arithmetic;
mod data_manipulation;
mod decorators;
mod jumps;
mod logic;
mod memory;

use crate::emulator::EmulatorInstruction;

pub use arithmetic::*;
pub use data_manipulation::*;
pub use decorators::*;
pub use jumps::*;
pub use logic::*;
pub use memory::*;

/// ForwardCom supports 128 bit operands, but this emulator doesn't yet.
#[inline]
pub fn quad_word_not_supported(instruction: &mut EmulatorInstruction) {
    log::debug!("Error: Tried to use 128 bit operand in instruction, this is not supported yet");
    instruction.valid = false;
}

/// Some instructions cannot be used with floating point operands.
#[inline]
pub fn no_floating_point(instruction: &mut EmulatorInstruction) {
    log::debug!("Error: Executed integer instruction on float operands");
    instruction.valid = false;
}

/// Some instruction are not supported with integer operands.
#[inline]
pub fn no_integer(instruction: &mut EmulatorInstruction) {
    log::debug!("Error: Executed floating point instruction on integer operands");
    instruction.valid = false;
}