use crate::traits::bus_device::BusDevice;
use crate::traits::memory_chip::MemoryChip;

// MOS6111
// AKA MCS6111
// 128B/1024b RAM
pub struct Mos6111 {
    data: Box<[u8]>,
    offset: u16,
    max_offset: u16
}

impl Mos6111 {
    pub fn new(min_offset: u16, max_offset: u16) -> Self {
        Mos6111 {
            data: Box::new([0x00u8; 64]),
            offset: min_offset,
            max_offset
        }
    }
}

impl BusDevice for Mos6111 {
    fn min_offset(&self) -> u16 {
        self.offset
    }

    fn max_offset(&self) -> u16 {
        self.max_offset
    }

    fn data_bus(&self) -> u8 {
        todo!()
    }

    fn set_address_bus(&mut self, new_value: u16) {
        todo!()
    }

    fn set_data_bus(&mut self, new_value: u8) {
        todo!()
    }
}

impl MemoryChip for Mos6111 {
    fn read(&self, offset: &u16) -> u8 {
        println!("IA = {}", self.internal_address(*offset));
        0x00
    }
}