c64 0.1.0-alpha.1

Driver for the Commodore 64 platform
Documentation
//! HAL for the Commodore 64 BASIC ROM.

use crate::{
    hal::{AddressSpace, Basic, Kernal},
    pac::basic,
};

/// Type-safe interface to the BASIC ROM.
///
/// This can only be constructed when the memory configuration has the BASIC ROM overlay
/// enabled, making it safe to call BASIC and Kernal functions.
pub struct BasicRom<'a, CHAREN> {
    _asp: &'a AddressSpace<Kernal, Basic, CHAREN>,
}

impl<'a, CHAREN> BasicRom<'a, CHAREN> {
    /// Constructs an access API for the BASIC ROM overlay.
    pub fn new(asp: &'a AddressSpace<Kernal, Basic, CHAREN>) -> Self {
        Self { _asp: asp }
    }

    /// Returns the logarithm constants in the BASIC ROM.
    pub fn log_constants(&self) -> &basic::LogConstants {
        unsafe { &*basic::LOG_CONSTANTS }
    }

    /// Returns the inverse natural log (e^x) constants in the BASIC ROM.
    pub fn exp_constants(&self) -> &basic::ExpConstants {
        unsafe { &*basic::EXP_CONSTANTS }
    }
}